Merge pull request #202 from Merkost/delete_fix

Fixed on delete key click
This commit is contained in:
Tibor Kaputa 2023-06-22 11:44:56 +02:00 committed by GitHub
commit eb035798b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

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)
}