fix(desktop): fix text spacing in rich text viewer

Pure text paragraphs now render as a single Text composable instead
of individual words in FlowRow, eliminating unwanted inter-word gaps.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nrobi144
2026-05-25 09:50:43 +03:00
co-authored by Claude
parent d6875a144b
commit 64293f2fcc
@@ -186,12 +186,22 @@ fun DesktopRichTextViewer(
}
else -> {
FlowRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = if (paragraph.isRTL) Arrangement.End else Arrangement.Start,
) {
for (word in paragraph.words) {
RenderSegment(word, state, localCache, callbacks)
val hasOnlyText = paragraph.words.all { it is RegularTextSegment }
if (hasOnlyText) {
Text(
text = paragraph.words.joinToString("") { it.segmentText },
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface,
modifier = Modifier.fillMaxWidth(),
)
} else {
FlowRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = if (paragraph.isRTL) Arrangement.End else Arrangement.Start,
) {
for (word in paragraph.words) {
RenderSegment(word, state, localCache, callbacks)
}
}
}
}