top: improve the response to ^Z if awaiting line input

Now that line input offers users full editing freedom,
if top were to be suspended after issuing a prompt for
input, upon resumption an extra keystroke is necessary
to satisfy the outstanding read & refresh the display.

With this patch that extra keystroke is not necessary.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 477b10c0bd

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-02-22 00:00:00 -06:00 committed by Jaromir Capik
parent d497b1025a
commit 5c3fffcf28

View File

@ -1109,6 +1109,7 @@ static char *ioline (const char *prompt) {
len = strlen(buf);
key = iokey(2);
switch (key) {
case 0:
case kbd_ESC:
buf[0] = '\0'; // fall through !
case kbd_ENTER:
@ -1156,7 +1157,7 @@ static char *ioline (const char *prompt) {
}
putp(fmtmk("%s%s%s", tg2(beg, Msg_row), Cap_clr_eol, buf));
putp(tg2(beg+pos, Msg_row));
} while (key != kbd_ENTER && key != kbd_ESC);
} while (key && key != kbd_ENTER && key != kbd_ESC);
// weed out duplicates, including empty strings (top-of-stack)...
for (i = 0, plin = anchor; ; i++) {