From 5530995188a4e094f1f29e208271524a08d0426f Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 5 Mar 2022 14:44:37 -0800 Subject: reliably exit on confirmation Until now you had to press ctrl-x twice in rapid succession to exit if an app turned on non-blocking keyboard with nodelay(true). This became particularly noticeable after the previous change to anagrams.tlv, which could no longer exit. --- src/lcurses/window.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lcurses') 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) { -- cgit 1.4.1-2-gfad0