tweaks: adjust a comment, and reshuffle the setting of a boolean

master
Benno Schulenberg 2020-08-15 16:07:30 +02:00
parent d09055db43
commit fb98f0ced7
1 changed files with 6 additions and 8 deletions

View File

@ -224,8 +224,8 @@ void read_keys_from(WINDOW *win)
/* Read in the remaining characters using non-blocking input. */ /* Read in the remaining characters using non-blocking input. */
nodelay(win, TRUE); nodelay(win, TRUE);
/* When taking verbatim input, pause a moment after receiving an ESC, /* After an ESC, when ncurses does not translate escape sequences,
* to give the keyboard some time to bring the next code to ncurses. */ * give the keyboard some time to bring the next code to ncurses. */
if (input == ESC_CODE && (linger_after_escape || ISSET(RAW_SEQUENCES))) if (input == ESC_CODE && (linger_after_escape || ISSET(RAW_SEQUENCES)))
napms(20); napms(20);
@ -1372,13 +1372,10 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
int keycode, *yield; int keycode, *yield;
reveal_cursor = TRUE; reveal_cursor = TRUE;
linger_after_escape = TRUE;
/* Read in the first code. */ /* Read in the first code. */
keycode = get_input(win); keycode = get_input(win);
linger_after_escape = FALSE;
#ifndef NANO_TINY #ifndef NANO_TINY
/* When the window was resized, abort and return nothing. */ /* When the window was resized, abort and return nothing. */
if (keycode == KEY_WINCH) { if (keycode == KEY_WINCH) {
@ -1398,15 +1395,12 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
char *multibyte; char *multibyte;
reveal_cursor = FALSE; reveal_cursor = FALSE;
linger_after_escape = TRUE;
while (unicode == PROCEED) { while (unicode == PROCEED) {
keycode = get_input(win); keycode = get_input(win);
unicode = assemble_unicode(keycode); unicode = assemble_unicode(keycode);
} }
linger_after_escape = FALSE;
#ifndef NANO_TINY #ifndef NANO_TINY
if (keycode == KEY_WINCH) { if (keycode == KEY_WINCH) {
*count = 999; *count = 999;
@ -1473,6 +1467,8 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
fflush(stdout); fflush(stdout);
#endif #endif
linger_after_escape = TRUE;
/* Read in a single byte or two escapes. */ /* Read in a single byte or two escapes. */
input = parse_verbatim_kbinput(win, count); input = parse_verbatim_kbinput(win, count);
@ -1486,6 +1482,8 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
*count = 0; *count = 0;
} }
linger_after_escape = FALSE;
#ifndef NANO_TINY #ifndef NANO_TINY
/* Turn bracketed-paste mode back on. */ /* Turn bracketed-paste mode back on. */
printf("\x1B[?2004h"); printf("\x1B[?2004h");