From 1d7c17760620ec207972493d4e24a0269f5860a8 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 29 Jun 2016 15:53:08 +0200
Subject: [PATCH] input: don't drop a keystroke on the floor when the terminal
 resizes

This fixes the first part of https://savannah.gnu.org/bugs/?48331.

Reported-by: Mike Frysinger <vapier@gentoo.org>
---
 src/winio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c
index aa077818..d7494576 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -141,8 +141,10 @@ void get_key_buffer(WINDOW *win)
     input = wgetch(win);
 
 #ifndef NANO_TINY
-    if (the_window_resized())
+    if (the_window_resized()) {
+	ungetch(input);
 	input = KEY_WINCH;
+    }
 #endif
 
     if (input == ERR && nodelay_mode)
-- 
GitLab