Skip to content

Commit

Permalink
fix crash if place the cursor at the end, then holding the "Shift" ke…
Browse files Browse the repository at this point in the history
…y and click the previous character, then type something; also fix incorrect selection range if "Shift + Primary Click"
  • Loading branch information
sunny-chung committed Nov 16, 2024
1 parent 4ff1f44 commit ff2bd4c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1149,10 +1149,11 @@ private fun CoreBigMonospaceText(
val selectionStart = viewState.transformedSelectionStart
selectionEnd = getTransformedCharIndex(x = position.x, y = position.y, mode = ResolveCharPositionMode.Selection)
.let {
log.d { "getTransformedCharIndex = $it" }
viewState.roundedTransformedCursorIndex(it, CursorAdjustDirection.Bidirectional, transformedText, it, true)
}
log.v { "selectionEnd => $selectionEnd" }
viewState.transformedSelection = minOf(selectionStart, selectionEnd) .. maxOf(selectionStart, selectionEnd)
log.d { "shift press selectionStart = $selectionStart, selectionEnd = $selectionEnd" }
viewState.transformedSelection = minOf(selectionStart, selectionEnd) until maxOf(selectionStart, selectionEnd)
viewState.updateSelectionByTransformedSelection(transformedText)
} else {
viewState.transformedSelection = IntRange.EMPTY
Expand Down

0 comments on commit ff2bd4c

Please sign in to comment.