chiark / gitweb /
Towers: allow marking of clues as done with the keyboard
authorJonas Kölker <jonaskoelker@yahoo.com>
Thu, 1 Oct 2015 16:41:15 +0000 (18:41 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Oct 2015 16:12:20 +0000 (17:12 +0100)
puzzles.but
towers.c

index 2c8f91b143e3ffe69246fe94cef9a966acea613b..113f46256be171778038453c9254e7bac7c8987f 100644 (file)
@@ -2652,7 +2652,8 @@ Pressing M will fill in a full set of pencil marks in every square
 that does not have a main digit in it.
 
 Left-clicking a clue will mark it as done (grey it out), or unmark it
-if it is already marked.
+if it is already marked.  Holding Control or Shift and pressing an
+arrow key likewise marks any clue in the given direction.
 
 (All the actions described in \k{common-actions} are also available.)
 
index b5092f013ce403a0a97655f391fe98983e1d3769..7666af9e00cb499312092262838ab5ab49f6ee49 100644 (file)
--- a/towers.c
+++ b/towers.c
@@ -1292,6 +1292,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
                             int x, int y, int button)
 {
     int w = state->par.w;
+    int shift_or_control = button & (MOD_SHFT | MOD_CTRL);
     int tx, ty;
     char buf[80];
 
@@ -1376,6 +1377,20 @@ static char *interpret_move(const game_state *state, game_ui *ui,
         }
     }
     if (IS_CURSOR_MOVE(button)) {
+        if (shift_or_control) {
+            int x = ui->hx, y = ui->hy;
+            switch (button) {
+            case CURSOR_LEFT:   x = -1; break;
+            case CURSOR_RIGHT:  x =  w; break;
+            case CURSOR_UP:     y = -1; break;
+            case CURSOR_DOWN:   y =  w; break;
+            }
+            if (is_clue(state, x, y)) {
+                sprintf(buf, "%c%d,%d", 'D', x, y);
+                return dupstr(buf);
+            }
+            return NULL;
+        }
         move_cursor(button, &ui->hx, &ui->hy, w, w, 0);
         ui->hshow = ui->hcursor = 1;
         return "";