diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt index 598139567..adb888695 100644 --- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt +++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt @@ -452,12 +452,12 @@ class InputService : AccessibilityService() { Log.d(logTag, "existing text:$text textToCommit:$textToCommit textSelectionStart:$textSelectionStart textSelectionEnd:$textSelectionEnd") if (textToCommit != null) { - var newText = "" - if ((textSelectionStart == -1) || (textSelectionEnd == -1)) { - newText = textToCommit + val newText = textToCommit + this.fakeEditTextForTextStateCalculation?.setText(newText) success = updateTextForAccessibilityNode(node) } else if (text != null) { + this.fakeEditTextForTextStateCalculation?.setText(text) this.fakeEditTextForTextStateCalculation?.text?.insert(textSelectionStart, textToCommit) success = updateTextAndSelectionForAccessibiltyNode(node) }