Fixed on delete key click

This commit is contained in:
merkost 2023-06-22 19:12:13 +10:00
parent 637f069a65
commit ed4ba59134

View File

@ -104,8 +104,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
MyKeyboard.KEYCODE_DELETE -> {
val selectedText = inputConnection.getSelectedText(0)
if (TextUtils.isEmpty(selectedText)) {
inputConnection.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
inputConnection.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL))
inputConnection.deleteSurroundingText(1, 0)
} else {
inputConnection.commitText("", 1)
}