Skip to content

Commit

Permalink
disable key repeat if it has popup keys
Browse files Browse the repository at this point in the history
  • Loading branch information
devycarol committed Jun 30, 2024
1 parent 53faab7 commit da649c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/helium314/keyboard/keyboard/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -1171,12 +1171,14 @@ public KeyParams(
if (mCode <= Constants.CODE_SPACE && mCode != KeyCode.MULTIPLE_CODE_POINTS && mIconName == null)
actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW;
switch (mCode) {
case KeyCode.DELETE, KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT, KeyCode.ARROW_UP, KeyCode.ARROW_DOWN:
case KeyCode.DELETE, KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT, KeyCode.ARROW_UP, KeyCode.ARROW_DOWN:
// repeating is disabled if a key is configured with pop-ups
if (mPopupKeys == null)
actionFlags |= ACTION_FLAGS_IS_REPEATABLE;
// fallthrough
case KeyCode.SHIFT, Constants.CODE_ENTER, KeyCode.SHIFT_ENTER, KeyCode.ALPHA, Constants.CODE_SPACE, KeyCode.NUMPAD,
KeyCode.SYMBOL, KeyCode.SYMBOL_ALPHA, KeyCode.LANGUAGE_SWITCH, KeyCode.EMOJI, KeyCode.CLIPBOARD:
actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW; // no preview even if icon!
// fallthrough
case KeyCode.SHIFT, Constants.CODE_ENTER, KeyCode.SHIFT_ENTER, KeyCode.ALPHA, Constants.CODE_SPACE, KeyCode.NUMPAD,
KeyCode.SYMBOL, KeyCode.SYMBOL_ALPHA, KeyCode.LANGUAGE_SWITCH, KeyCode.EMOJI, KeyCode.CLIPBOARD:
actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW; // no preview even if icon!
}
if (mCode == KeyCode.SETTINGS || mCode == KeyCode.LANGUAGE_SWITCH)
actionFlags |= ACTION_FLAGS_ALT_CODE_WHILE_TYPING;
Expand Down
1 change: 1 addition & 0 deletions layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ If the layout has exactly 2 keys in the bottom row, these keys will replace comm
* `popup`: list of keys to add in the popup, e.g. `"label": ")", "popup": {"relevant": [{ "label": "." }]}` is a `)` key with a `.` popup
* Note that in popup keys, properties are ignored with the exception of `$`, `code`, `codePoints`, and `label`
* When specifying a _selector_ key class in a popup key, it will be evaluated correctly (e.g. for changing popups dependent on shift state)
* If popups are added to repeating keys (e.g. delete, arrow keys), repetition will be disabled.
* `width`: width of the key in units of screen width, e.g. a key with `"width": 0.1` has a width of 10% of the screen, defaults to `0`
* A special value is `-1`, which means the key expands to the available space not already used by other keys (e.g. the space bar)
* `0` is interpreted as follows
Expand Down

0 comments on commit da649c2

Please sign in to comment.