Safer cursor handling

This commit is contained in:
Sad Ellie 2023-02-27 00:28:26 +04:00
parent 4be56ccb0d
commit eeda3cc6ed

View File

@ -124,6 +124,8 @@ class TextFieldController @Inject constructor() {
fun moveCursor(newPosition: IntRange) {
val currentInput = input.value.text
if (newPosition.last > currentInput.length) return
val fixedLeftCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.first)
val fixedRightCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.last)