Closed fornewid closed 2 months ago
Reproduced:
@Composable
@Preview
fun App() {
var currentText: String by remember { mutableStateOf("") }
Column {
BasicText(
text = currentText,
modifier = Modifier.width(100.dp),
onTextLayout = { result ->
val lastLine = result.lineCount - 1
val isEllipsized = result.isLineEllipsized(lineIndex = lastLine) // always returns false
println("isEllipsized($lastLine) = $isEllipsized")
},
overflow = TextOverflow.Ellipsis,
maxLines = 3,
)
TextField(currentText, onValueChange = { currentText = it })
}
}
@fornewid
Please let me know, if I should report this bug in the
Hi, I found problem in:
androidx.compose.ui.text.SkiaParagraph.skiko.kt override fun isLineEllipsized(lineIndex: Int) = false
This class responses for desktop realisation. Obviosly, the result, which you wait always returns false. You should report about the bug.
@AntonButov Yes, that's right.
However, only the android library is published in Jetpack Compose.
So I thought the SkiaParagraph.skiko.kt
code should be modified in compose-multiplatform-core project.
Did I think wrong?
compose-multiplatform-core is fork of JetPack Compose. Yes, it's really strange why the desktop implementation placed in Android's Jatpack and called AndroidX. But I am sure that AndroidParagraph.android.kt::isLineEllipsized works when launching the Android application. Work good. The desktop application uses SkiaParagraph.skiko.kt::isLineEllipsized. Work bad. Both of these classes resolve interface. Perhaps androidx is not being renamed becouse not to break compatibility.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug Currently I'm working on ReadMoreTextView library to support Compose Multiplatform. (https://github.com/webtoon/ReadMoreTextView/pull/60)
But I have an issue on
Text
composables. WhenTextLayoutResult
is received throughonTextLayout
ofCoreText
,TextLayoutResult#isLineEllipsized
always returns false.Please let me know, if I should report this bug in the Jetpack Compose tracker.
Affected platforms Select one of the platforms below:
Versions
To Reproduce Steps and/or the code snippet to reproduce the behavior:
Expected behavior If
currentText
exceedsmaxLines
andcurrentText
is ellipsized,result.isLineEllipsized()
should returntrue
.Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.