diff --git a/doc/fixes36.2 b/doc/fixes36.2 index e5e7df4a9..a56ab4b9f 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -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 diff --git a/include/wintty.h b/include/wintty.h index b121c4d6e..9a375145e 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -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 *)); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index d888f6d67..145a535fe 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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])