chiark / gitweb /
Fix a misrendering in Guess.
authorJonas Kölker <jonaskoelker@yahoo.com>
Thu, 1 Oct 2015 15:42:48 +0000 (17:42 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Oct 2015 16:08:21 +0000 (17:08 +0100)
When the cursor was visible, redrawing after undo-redo or label
toggling or resizing would draw background over the top of the
circular cursor.

guess.c

diff --git a/guess.c b/guess.c
index 5a53b01bf7ad9d9bbaa847a9213bb98b41153363..37030d1e402367396ae87ccffd8fe0d330df3e05 100644 (file)
--- a/guess.c
+++ b/guess.c
@@ -1247,29 +1247,31 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
     }
 
     /* 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. */
     if (new_move)