Fix curses quitting when trying to move

parse_escape_sequence changed getch timeout, but when receiving
a certain escape sequence, it returned without changing the
timeout back. This caused all subsequent getch calls be
non-blocking, and getch returns ERR when there's no input
waiting in that mode.

NetHack interprets ERR as the terminal going away, so performs
an automatic save.
This commit is contained in:
Pasi Kallinen
2023-03-08 12:16:43 +02:00
parent 4021a63bcf
commit 96587d2acf

View File

@@ -1073,8 +1073,10 @@ parse_escape_sequence(void)
if (ret == 'O') { /* Numeric keypad */
/* ESC O <something> */
ret = getch();
if (ret >= 112 && ret <= 121)
if (ret >= 112 && ret <= 121) {
timeout(-1);
return ret - 112 + '0'; /* Convert to number */
}
if (ret == ERR)
ret = 'O'; /* there was no third char; treat as ESC O below */