1
0
Fork 0

fixed Backspace not working properly in Termux, when delayed accept is enabled in ABC mode

This commit is contained in:
sspanak 2024-04-03 19:32:38 +03:00 committed by Dimo Karaivanov
parent af6ee5114f
commit 04b66745d1
2 changed files with 8 additions and 6 deletions

View file

@ -97,12 +97,15 @@ public abstract class TypingHandler extends KeyPadHandler {
public boolean onBackspace() { public boolean onBackspace() {
// 1. Dialer fields seem to handle backspace on their own and we must ignore it, // Dialer fields seem to handle backspace on their own and we must ignore it,
// otherwise, keyDown race condition occur for all keys. // otherwise, keyDown race condition occur for all keys.
// 2. Allow the assigned key to function normally, when there is no text (e.g. "Back" navigates back) if (mInputMode.isPassthrough()) {
// 3. Some app may need special treatment, so let it be. return false;
boolean noTextBeforeCursor = textField.getStringBeforeCursor(1).isEmpty(); }
if (mInputMode.isPassthrough() || appHacks.onBackspace(mInputMode) || noTextBeforeCursor) {
// * Some app may need special treatment, so let them be.
// * When there is no text, allow double function keys to function normally (e.g. "Back" navigates back)
if (appHacks.onBackspace(mInputMode) || textField.getStringBeforeCursor(1).isEmpty()) {
mInputMode.reset(); mInputMode.reset();
return false; return false;
} }

View file

@ -120,7 +120,6 @@ public class AppHacks {
inputMode.clearWordStem(); inputMode.clearWordStem();
} else if (isTermux()) { } else if (isTermux()) {
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL); sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
return true;
} }
return false; return false;