display cleanup only targets the right-most field where it's needed

This commit is contained in:
nhmall
2018-09-28 12:55:30 -04:00
parent bdc9a6b98e
commit 394c72d366
3 changed files with 17 additions and 2 deletions

View File

@@ -169,6 +169,7 @@ tty: ensure that current status fields are always copied to prior status
values so that comparisons are correct
tty: fix an out of bounds error in tty_status_update() for BL_HUNGER case
tty: fix leftover display artifact when last field on the row got smaller
and optimize so only the right-most field requires the cleanup code
X11: its use of genl_status_update exposed a negative index use that could
lead to a segfault

View File

@@ -229,6 +229,8 @@ E short FDECL(set_tty_font_name, (winid, char *));
#endif
E char *NDECL(tty_get_color_string);
#endif
E void FDECL(tty_status_enablefield,
(int, const char *, const char *, BOOLEAN_P));
E void NDECL(tty_status_init);
E void FDECL(tty_status_update, (int, genericptr_t, int, int, int, unsigned long *));

View File

@@ -103,7 +103,7 @@ struct window_procs tty_procs = {
#endif
tty_getmsghistory, tty_putmsghistory,
tty_status_init,
genl_status_finish, genl_status_enablefield,
genl_status_finish, tty_status_enablefield,
#ifdef STATUS_HILITES
tty_status_update,
#else
@@ -3599,6 +3599,18 @@ tty_status_init()
genl_status_init();
}
void
tty_status_enablefield(fieldidx, nm, fmt, enable)
int fieldidx;
const char *nm;
const char *fmt;
boolean enable;
{
genl_status_enablefield(fieldidx, nm, fmt, enable);
/* force re-evaluation of last field on the row */
setlast = FALSE;
}
void
do_setlast()
{
@@ -3606,7 +3618,7 @@ do_setlast()
setlast = TRUE;
for (row = 0; row < 2; ++row)
for (i = MAX_PER_ROW - 1; i ; --i) {
for (i = MAX_PER_ROW - 1; i > 0; --i) {
fld = fieldorder[row][i];
if (fld == BL_FLUSH || !status_activefields[fld])