shithub: puzzles

Download patch

ref: 785de41a92dcd45a71c322bafa8af737bb1eb7aa
parent: 8c768e7444707b1985788d610e8f14148bc36ab6
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Aug 9 07:42:51 EDT 2023

Appropriately generate MOVE_NO_EFFECT from '\b' in Guess

This is the case that I care about for KaiOS.

--- a/guess.c
+++ b/guess.c
@@ -943,9 +943,12 @@
             ui->peg_cur++;
         ret = MOVE_UI_UPDATE;
     } else if (button == 'D' || button == 'd' || button == '\b') {
-        ui->display_cur = true;
-        set_peg(&from->params, ui, ui->peg_cur, 0);
-        ret = MOVE_UI_UPDATE;
+        if (!ui->display_cur || ui->curr_pegs->pegs[ui->peg_cur] != 0) {
+            ui->display_cur = true;
+            set_peg(&from->params, ui, ui->peg_cur, 0);
+            ret = MOVE_UI_UPDATE;
+        } else
+            ret = MOVE_NO_EFFECT;
     } else if (button == CURSOR_SELECT2) {
         if (ui->peg_cur == from->params.npegs)
             return NULL;