mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 19:35:48 +00:00
minor fixes
This commit is contained in:
+1
-1
@@ -1139,7 +1139,7 @@ fun ChatLayout(
|
||||
if (appPlatform.isDesktop) {
|
||||
val manager = LocalSelectionManager.current
|
||||
val range = manager?.range
|
||||
if (manager != null && manager.selectionState == SelectionState.Selected && manager.onCopySelection != null && range != null && manager.focusCharRect != Rect.Zero) {
|
||||
if (manager != null && manager.selectionState == SelectionState.Selected && range != null && manager.focusCharRect != Rect.Zero) {
|
||||
val draggingDown = range.startIndex > range.endIndex || (range.startIndex == range.endIndex && range.startOffset < range.endOffset)
|
||||
val gap = with(LocalDensity.current) { 4.dp.toPx() }
|
||||
var buttonSize by remember { mutableStateOf(IntSize.Zero) }
|
||||
|
||||
+2
-2
@@ -110,7 +110,7 @@ class SelectionManager {
|
||||
val r = range ?: return IntOffset.Zero
|
||||
val ls = listState?.value ?: return IntOffset.Zero
|
||||
val itemInfo = ls.layoutInfo.visibleItemsInfo.find { it.index == r.endIndex }
|
||||
?: return IntOffset(0, -10000)
|
||||
?: return IntOffset(-10000, -10000)
|
||||
val itemWindowY = (ls.layoutInfo.viewportEndOffset - itemInfo.offset - itemInfo.size).toFloat()
|
||||
val cr = focusCharRect
|
||||
val vp = viewportPosition
|
||||
@@ -145,7 +145,7 @@ fun selectedRange(range: SelectionRange?, index: Int): IntRange? {
|
||||
if (index < lo || index > hi) return null
|
||||
return when {
|
||||
index == r.startIndex && index == r.endIndex ->
|
||||
if (r.startOffset < 0 || r.endOffset < 0 || r.startOffset == r.endOffset) null
|
||||
if (r.startOffset < 0 || r.endOffset < 0) null
|
||||
else minOf(r.startOffset, r.endOffset) .. maxOf(r.startOffset, r.endOffset)
|
||||
index == r.startIndex ->
|
||||
if (r.startOffset < 0) null
|
||||
|
||||
+2
-2
@@ -406,7 +406,7 @@ fun ClickableText(
|
||||
val selectionHighlight = if (selectionRange != null) {
|
||||
Modifier.drawBehind {
|
||||
layoutResult.value?.let { result ->
|
||||
if (selectionRange.first < selectionRange.last && selectionRange.last + 1 <= text.length) {
|
||||
if (selectionRange.first <= selectionRange.last && selectionRange.last + 1 <= text.length) {
|
||||
drawPath(result.getPathForRange(selectionRange.first, selectionRange.last + 1), SelectionHighlightColor)
|
||||
}
|
||||
}
|
||||
@@ -441,7 +441,7 @@ private fun SelectableText(
|
||||
val highlight = if (selectionRange != null) {
|
||||
Modifier.drawBehind {
|
||||
layoutResult.value?.let { result ->
|
||||
if (selectionRange.first < selectionRange.last && selectionRange.last + 1 <= text.length) {
|
||||
if (selectionRange.first <= selectionRange.last && selectionRange.last + 1 <= text.length) {
|
||||
drawPath(result.getPathForRange(selectionRange.first, selectionRange.last + 1), SelectionHighlightColor)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user