Skip to content

Commit

Permalink
Improve function backspace()
Browse files Browse the repository at this point in the history
  • Loading branch information
bingzheung committed Sep 4, 2024
1 parent b4c7c22 commit f83d42f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,12 @@ class JyutpingInputMethodService: LifecycleInputMethodService(),
fun backspace() {
if (isBuffering.value) {
bufferText = bufferText.dropLast(1)
} else if (currentInputConnection.getSelectedText(0).isNullOrEmpty()) {
if (currentInputConnection.getTextBeforeCursor(1, 0).isNullOrEmpty().not()) {
currentInputConnection.deleteSurroundingTextInCodePoints(1, 0)
}
} else {
currentInputConnection.deleteSurroundingText(1, 0)
currentInputConnection.commitText(PresetString.EMPTY, PresetString.EMPTY.length)
}
}
fun performReturn() {
Expand Down

0 comments on commit f83d42f

Please sign in to comment.