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:
parent
012a0e6670
commit
aee9099a44
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user