top: avoid any potential race involving 'BREAK_screen' <=== port of newlib 3e5016c2

______________________________ original newlib message
----------------------------------- ( minus git hash )

When that 'Bottom' window was being finalized, an enum
of BREAK_screen was added to the Frames_signal values.
This was done so some full screen replacement function
could flag the need for that bottom window to go away.

Around that same time, top was made more responsive to
keyboard input so that residual portions of a previous
bottom window would not linger until the next refresh.
This happened if going from a larger (^N, environment)
bottom window to some smaller window (^P, namespaces).

The combined effect of these changes was to create the
potential race condition this commit addresses. If the
user encountered a SIGWINCH while on any of those full
screen replacement displays (help, fields mgmt, etc.),
endless redraws would occur. A ^C was the only option.

Henceforth we will protect against any redraw loops by
clearing Frames_signal each time a redraw is required.

[ along the way, we'll make the 'q' key work on that ]
t secondary 'windows' help screen as it should, even ]
[ though it is not documented on that screen itself. ]

Reference(s):
. May, 2022 - more responsive to keyboard input
commit ........................................
. May, 2022 - maybe force the bottom window off
commit ........................................

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-09-19 00:00:00 -05:00 committed by Craig Small
parent ca182cb894
commit e81b58beaa

View File

@ -2506,6 +2506,7 @@ static void fields_utility (void) {
spewFI spewFI
signify_that: signify_that:
Frames_signal = BREAK_off;
putp(Cap_clr_scr); putp(Cap_clr_scr);
adj_geometry(); adj_geometry();
@ -3556,6 +3557,7 @@ static int insp_view_choice (proc_t *p) {
int key, curlin = 0, curcol = 0; int key, curlin = 0, curcol = 0;
signify_that: signify_that:
Frames_signal = BREAK_off;
putp(Cap_clr_scr); putp(Cap_clr_scr);
adj_geometry(); adj_geometry();
@ -3678,6 +3680,7 @@ static void inspection_utility (int pid) {
// must re-hide cursor since the prompt for a pid made it huge // must re-hide cursor since the prompt for a pid made it huge
putp((Cursor_state = Cap_curs_hide)); putp((Cursor_state = Cap_curs_hide));
signify_that: signify_that:
Frames_signal = BREAK_off;
putp(Cap_clr_scr); putp(Cap_clr_scr);
adj_geometry(); adj_geometry();
@ -4778,6 +4781,7 @@ static void wins_colors (void) {
wins_clrhlp(w, 1); wins_clrhlp(w, 1);
putp((Cursor_state = Cap_curs_huge)); putp((Cursor_state = Cap_curs_huge));
signify_that: signify_that:
Frames_signal = BREAK_off;
putp(Cap_clr_scr); putp(Cap_clr_scr);
adj_geometry(); adj_geometry();
@ -5504,6 +5508,7 @@ static void help_view (void) {
putp((Cursor_state = Cap_curs_huge)); putp((Cursor_state = Cap_curs_huge));
signify_that: signify_that:
Frames_signal = BREAK_off;
putp(Cap_clr_scr); putp(Cap_clr_scr);
adj_geometry(); adj_geometry();
@ -5522,22 +5527,26 @@ signify_that:
if (key < 1) goto signify_that; if (key < 1) goto signify_that;
switch (key) { switch (key) {
// these keys serve the primary help screen
case kbd_ESC: case 'q': case kbd_ESC: case 'q':
break; break;
case '?': case 'h': case 'H': case '?': case 'h': case 'H':
do { do {
putp(Cap_home); signify_this:
Frames_signal = BREAK_off;
putp(Cap_clr_scr);
adj_geometry();
show_special(1, fmtmk(N_unq(WINDOWS_help_fmt) show_special(1, fmtmk(N_unq(WINDOWS_help_fmt)
, w->grpname , w->grpname
, Winstk[0].rc.winname, Winstk[1].rc.winname , Winstk[0].rc.winname, Winstk[1].rc.winname
, Winstk[2].rc.winname, Winstk[3].rc.winname)); , Winstk[2].rc.winname, Winstk[3].rc.winname));
putp(Cap_clr_eos); putp(Cap_clr_eos);
fflush(stdout); fflush(stdout);
if (Frames_signal || (key = iokey(IOKEY_ONCE)) < 1) { if (Frames_signal || (key = iokey(IOKEY_ONCE)) < 1)
adj_geometry(); goto signify_this;
putp(Cap_clr_scr); else w = win_select(key);
} else w = win_select(key); // these keys serve the secondary help screen
} while (key != kbd_ENTER && key != kbd_ESC); } while (key != kbd_ENTER && key != kbd_ESC && key != 'q');
break; break;
default: default:
goto signify_that; goto signify_that;