mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 15:22:07 +00:00
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:
1 parent
6f21826579
commit
01c9343cdd
2 files changed
+7
-5
No files matched your search
+4
-2
@@ -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
|
||||
) {
|
||||
|
||||
+3
-3
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user