Detect error on character input

Previously an error from the character input routine wgetch() was
silently ignored. It should still be ignored, but must explicitly be
detected in order to be ignored. The issue came up in connection with
terminal window resize. For whatever reasons ncurses returns ERR (as
well as KEY_RESIZE) when wgetch() asks for input after a resize.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2017-10-28 22:33:53 +02:00 committed by Lukas Fleischer
parent 012a0e6670
commit aee9099a44

View File

@ -247,8 +247,12 @@ int keys_wgetch(WINDOW *win)
int ch, i;
char buf[UTF8_MAXLEN];
ch = wgetch(win);
if (ch == ERR)
return ch;
/* Handle curses pseudo characters. */
if ((ch = wgetch(win)) >= KEY_MIN)
if (ch >= KEY_MIN)
return ch;
/* Handle 1-byte UTF-8 characters. */