From 08d189042d946e001bf8e9c94d5613dd500320e0 Mon Sep 17 00:00:00 2001 From: JARVIS Date: Tue, 27 Jan 2026 16:03:47 +0100 Subject: [PATCH] feat(android): enable text selection on all chat message content Previously, only code blocks were selectable in the chat UI. This change wraps the entire ChatMarkdown content in a SelectionContainer, allowing users to select and copy any text from chat messages (regular text, inline code, and code blocks). This matches the iOS behavior which uses .textSelection(.enabled). --- .../bot/molt/android/ui/chat/ChatMarkdown.kt | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/android/app/src/main/java/bot/molt/android/ui/chat/ChatMarkdown.kt b/apps/android/app/src/main/java/bot/molt/android/ui/chat/ChatMarkdown.kt index 10cf25b81..1efe65b5f 100644 --- a/apps/android/app/src/main/java/bot/molt/android/ui/chat/ChatMarkdown.kt +++ b/apps/android/app/src/main/java/bot/molt/android/ui/chat/ChatMarkdown.kt @@ -36,25 +36,25 @@ fun ChatMarkdown(text: String, textColor: Color) { val blocks = remember(text) { splitMarkdown(text) } val inlineCodeBg = MaterialTheme.colorScheme.surfaceContainerLow - Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { - for (b in blocks) { - when (b) { - is ChatMarkdownBlock.Text -> { - val trimmed = b.text.trimEnd() - if (trimmed.isEmpty()) continue - Text( - text = parseInlineMarkdown(trimmed, inlineCodeBg = inlineCodeBg), - style = MaterialTheme.typography.bodyMedium, - color = textColor, - ) - } - is ChatMarkdownBlock.Code -> { - SelectionContainer(modifier = Modifier.fillMaxWidth()) { + SelectionContainer { + Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { + for (b in blocks) { + when (b) { + is ChatMarkdownBlock.Text -> { + val trimmed = b.text.trimEnd() + if (trimmed.isEmpty()) continue + Text( + text = parseInlineMarkdown(trimmed, inlineCodeBg = inlineCodeBg), + style = MaterialTheme.typography.bodyMedium, + color = textColor, + ) + } + is ChatMarkdownBlock.Code -> { ChatCodeBlock(code = b.code, language = b.language) } - } - is ChatMarkdownBlock.InlineImage -> { - InlineBase64Image(base64 = b.base64, mimeType = b.mimeType) + is ChatMarkdownBlock.InlineImage -> { + InlineBase64Image(base64 = b.base64, mimeType = b.mimeType) + } } } }