chiark / gitweb /
Unequal: stop ignoring keys 'h' and 'm' while cursor active.
authorJonas Kölker <jonaskoelker@yahoo.com>
Mon, 21 Sep 2015 14:41:03 +0000 (16:41 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Oct 2015 15:58:11 +0000 (16:58 +0100)
At least, so long as 'h' and 'm' are not "numbers".

unequal.c

index 3a518d9cd5a679b03beb47fd8132d72dcce3cee0..54300e1288609819dcd3ef2cae604caf0a175a43 100644 (file)
--- a/unequal.c
+++ b/unequal.c
@@ -1427,18 +1427,15 @@ static char *interpret_move(const game_state *state, game_ui *ui,
         return "";
     }
 
-
-    if (ui->hshow) {
+    n = c2n(button, state->order);
+    if (ui->hshow && n >= 0 && n <= ds->order) {
         debug(("button %d, cbutton %d", button, (int)((char)button)));
-        n = c2n(button, state->order);
 
         debug(("n %d, h (%d,%d) p %d flags 0x%x nums %d",
                n, ui->hx, ui->hy, ui->hpencil,
                GRID(state, flags, ui->hx, ui->hy),
                GRID(state, nums, ui->hx, ui->hy)));
 
-        if (n < 0 || n > ds->order)
-            return NULL;        /* out of range */
         if (GRID(state, flags, ui->hx, ui->hy) & F_IMMUTABLE)
             return NULL;        /* can't edit immutable square (!) */
         if (ui->hpencil && GRID(state, nums, ui->hx, ui->hy) > 0)