mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-20 09:15:26 +02:00
Safer cursor handling
This commit is contained in:
parent
4be56ccb0d
commit
eeda3cc6ed
@ -124,6 +124,8 @@ class TextFieldController @Inject constructor() {
|
|||||||
|
|
||||||
fun moveCursor(newPosition: IntRange) {
|
fun moveCursor(newPosition: IntRange) {
|
||||||
val currentInput = input.value.text
|
val currentInput = input.value.text
|
||||||
|
if (newPosition.last > currentInput.length) return
|
||||||
|
|
||||||
val fixedLeftCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.first)
|
val fixedLeftCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.first)
|
||||||
val fixedRightCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.last)
|
val fixedRightCursor = cursorFixer.fixCursorIfNeeded(currentInput, newPosition.last)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user