]> granicus.if.org Git - nethack/commitdiff
tty column placement of BL_HUNGER and BL_CAP could collide
authornhmall <nhmall@nethack.org>
Wed, 12 Sep 2018 23:42:45 +0000 (19:42 -0400)
committernhmall <nhmall@nethack.org>
Wed, 12 Sep 2018 23:42:45 +0000 (19:42 -0400)
Change the placement of the code that makes a replica of the
current status fields for later comparison.

A loop shortcut was causing it to be skipped under some
circumstances and that was negatively impacting the placement
of status field values that were further to the right.

doc/fixes36.2
win/tty/wintty.c

index 69a952609b4d3e8139c0db5c4c8b7aa2240ce710..82680868bd034bcd866bd82ee3b01573bee97bf4 100644 (file)
@@ -125,6 +125,8 @@ setting the inverse attribute for gold had the space before "$:"
 sortloot segfaulted when filtering a subset of items (seen with 'A' command)
 tty: turn off an optimization that is the suspected cause of Windows reported 
        partial status lines following level changes
+tty: ensure that current status fields are always copied to prior status
+       values so that comparisons are correct
 
 
 Platform- and/or Interface-Specific Fixes
index 6e02149112d76b9cbebb6da67e6f6d3775877831..5c98c02992399f63ae736d72f5f929b6dac9d56a 100644 (file)
@@ -3837,7 +3837,8 @@ int *topsz, *bottomsz;
             tty_status[NOW][idx].y = row;
             tty_status[NOW][idx].x = col;
 
-            /* evaluate */
+            /* On a change to the field length, everything 
+               further to the right must be updated as well */
             if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth)
                 update_right = TRUE;
 
@@ -4129,16 +4130,11 @@ render_status(VOID_ARGS)
         for (i = 0; fieldorder[row][i] != BL_FLUSH; ++i) {
             int fldidx = fieldorder[row][i];
 
-            if (do_field_opt && !tty_status[NOW][fldidx].redraw)
-                continue;
-            /*
-             * Ignore zero length fields. check_fields() didn't count
-             * them in either.
-             */
-            if (!tty_status[NOW][fldidx].lth && fldidx != BL_CONDITION)
+            if (!status_activefields[fldidx])
                 continue;
 
-            if (status_activefields[fldidx]) {
+            if ((tty_status[NOW][fldidx].lth || fldidx == BL_CONDITION)
+                 && (tty_status[NOW][fldidx].redraw || !do_field_opt)) {
                 int coloridx = tty_status[NOW][fldidx].color;
                 int attridx = tty_status[NOW][fldidx].attr;
                 int x = tty_status[NOW][fldidx].x;
@@ -4296,15 +4292,16 @@ render_status(VOID_ARGS)
                         End_Attr(attridx);
                     }
                 }
-                /* reset .redraw and .dirty now that they've been rendered */
-                tty_status[NOW][fldidx].dirty  = FALSE;
-                tty_status[NOW][fldidx].redraw = FALSE;
-                /*
-                 * Make a copy of the entire tty_status struct for comparison
-                 * of current and previous.
-                 */
-                tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx];
             }
+            /* reset .redraw and .dirty now that they've been rendered */
+            tty_status[NOW][fldidx].dirty  = FALSE;
+            tty_status[NOW][fldidx].redraw = FALSE;
+
+            /*
+             * Make a copy of the entire tty_status struct for comparison
+             * of current and previous.
+             */
+             tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx];
         }
     }
     if (cond_disp_width[NOW] < cond_width_at_shrink) {