nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit fb98f0ced7f3da31be277ca3619203a07e1ee102
parent d09055db4367c6726a4fbf92518b2e96cc9bb99e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 15 Aug 2020 16:07:30 +0200

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

Diffstat:
Msrc/winio.c | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

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