diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-05 16:35:41 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-05 16:35:41 +0000 |
| commit | 01569005e325fc85e4a23fc050b7406789730444 (patch) | |
| tree | 71199fc7f4c907c62666872e0fdc89bf8e4f7ece | |
| parent | fe40cda75a9665f7b464fa9909de0a7f62613817 (diff) | |
| download | puzzles-01569005e325fc85e4a23fc050b7406789730444.zip puzzles-01569005e325fc85e4a23fc050b7406789730444.tar.gz puzzles-01569005e325fc85e4a23fc050b7406789730444.tar.bz2 puzzles-01569005e325fc85e4a23fc050b7406789730444.tar.xz | |
Further restrict the keys that can have MOD_NUM_KEYPAD
In all front ends other than JavaScript, and in JavaScript prior to my
recent changes, MOD_NUM_KEYPAD can only be set on ASCII digits. For
now, enforce this in midend_process_key() so as to avoid inconsistency
between front ends. It might be useful to be able to distinguish
keypad versions of more keys, but that should be co-ordinated across
the code-base.
| -rw-r--r-- | midend.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1182,8 +1182,8 @@ bool midend_process_key(midend *me, int x, int y, int button, bool *handled) /* interpret_move() expects CTRL and SHFT only on cursor keys. */ if (!IS_CURSOR_MOVE(button & ~MOD_MASK)) button &= ~(MOD_CTRL | MOD_SHFT); - /* ... and NUM_KEYPAD only on printable ASCII values. */ - if ((button & ~MOD_MASK) < 0x20 || (button & ~MOD_MASK) >= 0x80) + /* ... and NUM_KEYPAD only on numbers. */ + if ((button & ~MOD_MASK) < '0' || (button & ~MOD_MASK) > '9') button &= ~MOD_NUM_KEYPAD; /* * Translate keyboard presses to cursor selection. |