shithub: puzzles

Download patch

ref: 8889fafb07d47ba359ad071789f340df866a0321
parent: 5cb91f28ba609d04d8948860c34520b66ea16718
author: Jonas Kölker <jonaskoelker@yahoo.com>
date: Thu Oct 1 13:42:48 EDT 2015

Fix a misrendering in Guess.

When the cursor was visible, redrawing after undo-redo or label
toggling or resizing would draw background over the top of the
circular cursor.

--- a/guess.c
+++ b/guess.c
@@ -1247,28 +1247,30 @@
     }
 
     /* draw the guesses (so far) and the hints
-     * (in reverse order to avoid trampling holds) */
+     * (in reverse order to avoid trampling holds, and postponing the
+     * next_go'th to not overrender the top of the circular cursor) */
     for (i = state->params.nguesses - 1; i >= 0; i--) {
-        if (state->next_go > i || state->solved) {
+        if (i < state->next_go || state->solved) {
             /* this info is stored in the game_state already */
             guess_redraw(dr, ds, i, state->guesses[i], NULL, -1, 0,
                          ui->show_labels);
             hint_redraw(dr, ds, i, state->guesses[i],
                         i == (state->next_go-1) ? 1 : 0, FALSE, FALSE);
-        } else if (state->next_go == i) {
-            /* this is the one we're on; the (incomplete) guess is
-             * stored in the game_ui. */
-            guess_redraw(dr, ds, i, ui->curr_pegs,
-                         ui->holds, ui->display_cur ? ui->peg_cur : -1, 0,
-                         ui->show_labels);
-            hint_redraw(dr, ds, i, NULL, 1,
-                        ui->display_cur && ui->peg_cur == state->params.npegs,
-                        ui->markable);
-        } else {
+        } else if (i > state->next_go) {
             /* we've not got here yet; it's blank. */
             guess_redraw(dr, ds, i, NULL, NULL, -1, 0, ui->show_labels);
             hint_redraw(dr, ds, i, NULL, 0, FALSE, FALSE);
         }
+    }
+    if (!state->solved) {
+	/* this is the one we're on; the (incomplete) guess is stored in
+	 * the game_ui. */
+	guess_redraw(dr, ds, state->next_go, ui->curr_pegs,
+		     ui->holds, ui->display_cur ? ui->peg_cur : -1, 0,
+		     ui->show_labels);
+	hint_redraw(dr, ds, state->next_go, NULL, 1,
+		    ui->display_cur && ui->peg_cur == state->params.npegs,
+		    ui->markable);
     }
 
     /* draw the 'current move' and 'able to mark' sign. */