shithub: puzzles

Download patch

ref: 11a394f69b43ce36e4b0119699a4ae9461d252ee
parent: ebf31f52b0dae356c7ad515b3e2e66672bd69a4e
author: Jonas Kölker <jonaskoelker@yahoo.com>
date: Mon Sep 21 14:34:53 EDT 2015

Add more keyboard controls to Slant.

--- a/puzzles.but
+++ b/puzzles.but
@@ -1709,7 +1709,10 @@
 
 You can also use the cursor keys to move around the grid. Pressing the
 return or space keys will place a \cw{\\} or a \cw{/}, respectively,
-and will then cycle them as above.
+and will then cycle them as above.  You can also press \cw{/} or
+\cw{\\} to place a \cw{/} or \cw{\\}, respectively, independent of
+what is already in the cursor square.  Backspace removes any line from
+the cursor square.
 
 (All the actions described in \k{common-actions} are also available.)
 
--- a/slant.c
+++ b/slant.c
@@ -1719,6 +1719,11 @@
         move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, 0);
         ui->cur_visible = 1;
         return "";
+    } else if (button == '\\' || button == '\b' || button == '/') {
+	int x = ui->cur_x, y = ui->cur_y;
+	if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1]) return NULL;
+	sprintf(buf, "%c%d,%d", button == '\b' ? 'C' : button, x, y);
+	return dupstr(buf);
     }
 
     if (action != NONE) {