mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Treat keypad-Enter as CURSOR_SELECT, same as Return.
The two Return/Enter keys have always been treated the same in the past, but a user complained today that Enter was no longer functioning as CURSOR_SELECT in the web puzzles. This happened in commit 9dbcfa765ba59a8, apparently because the web front end is now translating the Enter key as MOD_NUM_KEYPAD | '\r' instead of just '\r', and the new code in midend.c is only stripping off MOD_NUM_KEYPAD for values >= 0x80. Now it strips MOD_NUM_KEYPAD off C0 control characters as well, so that only _printable_ ASCII characters can still have that modifier when they get to the backend - i.e. you can tell numpad digits from normal digits, and ditto +-* etc. But keypad Enter is now turned into plain '\r' by the modifier removal code, and then into CURSOR_SELECT. Other front ends still aren't even bothering to set MOD_NUM_KEYPAD on the code sent by Enter. But that's fine, because now midend.c officially doesn't care whether they do or not.
This commit is contained in:
4
midend.c
4
midend.c
@ -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. */
|
/* interpret_move() expects CTRL and SHFT only on cursor keys. */
|
||||||
if (!IS_CURSOR_MOVE(button & ~MOD_MASK))
|
if (!IS_CURSOR_MOVE(button & ~MOD_MASK))
|
||||||
button &= ~(MOD_CTRL | MOD_SHFT);
|
button &= ~(MOD_CTRL | MOD_SHFT);
|
||||||
/* ... and NUM_KEYPAD only on ASCII values. */
|
/* ... and NUM_KEYPAD only on printable ASCII values. */
|
||||||
if ((button & ~MOD_MASK) >= 0x80)
|
if ((button & ~MOD_MASK) < 0x20 || (button & ~MOD_MASK) >= 0x80)
|
||||||
button &= ~MOD_NUM_KEYPAD;
|
button &= ~MOD_NUM_KEYPAD;
|
||||||
/*
|
/*
|
||||||
* Translate keyboard presses to cursor selection.
|
* Translate keyboard presses to cursor selection.
|
||||||
|
Reference in New Issue
Block a user