top: tweak cursor state code to swat an obscure buglet

An obscure bug has been discovered where a 'W' with an
old rcfile, warning against overwrite, would display a
cursor that should normally be hidden. This followed a
user's reply. So some logic was rearranged just a bit.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-07-05 00:00:00 -05:00 committed by Jaromir Capik
parent 6967bf80a6
commit 30e90e4269

View File

@ -3104,6 +3104,7 @@ signify_that:
case '/': case '/':
case 'n': case 'n':
insp_find_str(key, &curcol, &curlin); insp_find_str(key, &curcol, &curlin);
// must re-hide cursor in case a prompt for a string makes it huge
putp((Cursor_state = Cap_curs_hide)); putp((Cursor_state = Cap_curs_hide));
break; break;
case '=': case '=':
@ -4901,23 +4902,21 @@ static void do_key (int ch) {
}; };
int i; int i;
putp((Cursor_state = Cap_curs_hide));
switch (ch) { switch (ch) {
case 0: // ignored (always) case 0: // ignored (always)
case kbd_ESC: // ignored (sometimes) case kbd_ESC: // ignored (sometimes)
return; goto all_done;
case 'q': // no return from this guy case 'q': // no return from this guy
bye_bye(NULL); bye_bye(NULL);
case 'W': // no need for rebuilds case 'W': // no need for rebuilds
write_rcfile(); write_rcfile();
return; goto all_done;
default: // and now, the real work... default: // and now, the real work...
for (i = 0; i < MAXTBL(key_tab); ++i) for (i = 0; i < MAXTBL(key_tab); ++i)
if (strchr(key_tab[i].keys, ch)) { if (strchr(key_tab[i].keys, ch)) {
key_tab[i].func(ch); key_tab[i].func(ch);
Frames_signal = BREAK_kbd; Frames_signal = BREAK_kbd;
putp((Cursor_state = Cap_curs_hide)); goto all_done;
return;
} }
}; };
/* Frames_signal above will force a rebuild of all column headers and /* Frames_signal above will force a rebuild of all column headers and
@ -4943,6 +4942,8 @@ static void do_key (int ch) {
*/ */
show_msg(N_txt(UNKNOWN_cmds_txt)); show_msg(N_txt(UNKNOWN_cmds_txt));
all_done:
putp((Cursor_state = Cap_curs_hide));
} // end: do_key } // end: do_key