make arrow keys repeatable (#932)

only applies to keyboard keys, not in toolbar
This commit is contained in:
Devy Ballard 2024-07-01 13:30:29 -06:00 committed by GitHub
parent 74571a3202
commit a92d108444
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 7 deletions

View file

@ -1731,9 +1731,16 @@ public class LatinIME extends InputMethodService implements
return;
}
if (repeatCount > 0) {
if (code == KeyCode.DELETE && !mInputLogic.mConnection.canDeleteCharacters()) {
// No need to feedback when repeat delete key will have no effect.
return;
// No need to feedback when repeat delete/cursor keys will have no effect.
switch (code) {
case KeyCode.DELETE, KeyCode.ARROW_LEFT, KeyCode.ARROW_UP:
if (!mInputLogic.mConnection.canDeleteCharacters())
return;
break;
case KeyCode.ARROW_RIGHT, KeyCode.ARROW_DOWN:
if (!mInputLogic.mConnection.canForwardDeleteCharacters())
return;
break;
}
// TODO: Use event time that the last feedback has been generated instead of relying on
// a repeat count to thin out feedback.