desktop: use text pointer for text selection (#6787)

* desktop: use text pointer for text selection

* do not clear selection on ctrl-c

* crlf

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
EvgenyandEvgeny @ SimpleX Chat authored and GitHub committed 2026-04-11 20:13:32 +01:00
1 parent 6f21826579
commit 01c9343cdd
2 files changed
+7 -5

No files matched your search

@@ -312,7 +312,6 @@ fun BoxScope.SelectionHandler(
manager.listState = listState
manager.onCopySelection = {
clipboard.setText(AnnotatedString(manager.getSelectedCopiedText(mergedItems.value.items, linkMode)))
manager.clearSelection()
showToast(generalGetString(MR.strings.copied))
}
@@ -509,7 +508,10 @@ fun SelectionCopyButton() {
.background(MaterialTheme.colors.surface, RoundedCornerShape(20.dp))
.border(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f), RoundedCornerShape(20.dp))
.clip(RoundedCornerShape(20.dp))
.clickable { manager.onCopySelection?.invoke() }
.clickable {
manager.onCopySelection?.invoke()
manager.clearSelection()
}
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
@@ -299,7 +299,7 @@ fun MarkdownText (
}
val clampedRange = selectionRange?.let { it.first .. minOf(it.last, selectableEnd) }
if ((hasLinks && uriHandler != null) || hasSecrets || (hasCommands && sendCommandMsg != null)) {
val icon = remember { mutableStateOf(PointerIcon.Default) }
val icon = remember { mutableStateOf(PointerIcon.Text) }
ClickableText(annotatedText, style = style, selectionRange = clampedRange, modifier = modifier.pointerHoverIcon(icon.value), maxLines = maxLines, overflow = overflow,
onLongClick = { offset ->
if (hasLinks) {
@@ -336,7 +336,7 @@ fun MarkdownText (
if (hasAnnotation("WEB_URL") || hasAnnotation("SIMPLEX_URL") || hasAnnotation("OTHER_URL") || hasAnnotation("SECRET") || hasAnnotation("COMMAND")) {
PointerIcon.Hand
} else {
PointerIcon.Default
PointerIcon.Text
}
},
shouldConsumeEvent = { offset ->
@@ -431,7 +431,7 @@ private fun SelectableText(
BasicText(
text = text,
modifier = modifier.then(selectionHighlight(selectionRange, text.length, layoutResult)),
modifier = modifier.pointerHoverIcon(PointerIcon.Text).then(selectionHighlight(selectionRange, text.length, layoutResult)),
style = style,
maxLines = maxLines,
overflow = overflow,