about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/lcurses/window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lcurses/window.c b/src/lcurses/window.c
index e3fcc70..4ab3ad4 100644
--- a/src/lcurses/window.c
+++ b/src/lcurses/window.c
@@ -1343,7 +1343,11 @@ Wgetch(lua_State *L)
 		color_set(COLOR_PAIR_NORMAL, NULL);
 		attroff(A_BOLD|A_REVERSE);
 
-		if (wgetch(w) != c)
+		int secondc;
+		do  /* just in case getch is currently non-blocking (nodelay) */
+			secondc = wgetch(w);
+		while(secondc == ERR);
+		if (c != secondc)
 			return pushintresult(0);
 
 		if (c == CTRL_X) {