From 64293f2fcc047d26e97ab8051ac75aaabf9aa766 Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Mon, 25 May 2026 09:50:43 +0300 Subject: [PATCH] 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 --- .../desktop/ui/note/DesktopRichTextViewer.kt | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichTextViewer.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichTextViewer.kt index 3161a53f16..9039978f28 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichTextViewer.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichTextViewer.kt @@ -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) + } } } }