nano

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

commit 5527883c434e6dd81a4fe2d07e68b063a26876d7
parent ade93ccf25e748d26860262d7adfc19ed51ea75c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed,  1 Jan 2020 13:41:18 +0100

input: don't discard the first keystroke after a resize when using Slang

With ncurses, a window resize will cause getch() to return immediately
with some dummy value, which nano can discard.  But with Slang, getch()
will return only when the next keystroke is typed, so the received code
should then not be discarded.

This fixes https://savannah.gnu.org/bugs/?57507.

Diffstat:
Msrc/winio.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -173,6 +173,9 @@ void run_macro(void) * in the keystroke buffer. */ void read_keys_from(WINDOW *win) { +#if defined(USE_SLANG) && !defined(NANO_TINY) + bool skip_others = FALSE; +#endif int input = ERR; size_t errcount = 0; @@ -193,7 +196,11 @@ void read_keys_from(WINDOW *win) #ifndef NANO_TINY if (the_window_resized) { regenerate_screen(); +#ifdef USE_SLANG + skip_others = TRUE; +#else input = KEY_WINCH; +#endif } #endif if (input == ERR && !waiting_mode) { @@ -220,6 +227,10 @@ void read_keys_from(WINDOW *win) /* If we got a SIGWINCH, get out as the win argument is no longer valid. */ if (input == KEY_WINCH) return; +#ifdef USE_SLANG + if (skip_others) + return; +#endif #endif /* Read in the remaining characters using non-blocking input. */