Restoring a game can return to the wishing prompt
In TTY or curses, if the terminal goes away while you're in the wishing prompt, return to the prompt when the game is restored. Breaks saves.
This commit is contained in:
@@ -308,6 +308,7 @@ curses_character_input_dialog(
|
||||
answer = curses_read_char();
|
||||
#endif
|
||||
if (answer == ERR) {
|
||||
iflags.term_gone = 1;
|
||||
answer = def;
|
||||
break;
|
||||
}
|
||||
@@ -451,6 +452,8 @@ curses_ext_cmd(void)
|
||||
curs_set(0);
|
||||
prompt_width = (int) strlen(cur_choice);
|
||||
|
||||
if (letter == ERR)
|
||||
iflags.term_gone = 1;
|
||||
if (letter == '\033' || letter == ERR) {
|
||||
ret = -1;
|
||||
break;
|
||||
@@ -1518,6 +1521,7 @@ menu_get_selections(WINDOW *win, nhmenu *menu, int how)
|
||||
curletter = curses_getch();
|
||||
|
||||
if (curletter == ERR) {
|
||||
iflags.term_gone = 1;
|
||||
num_selected = -1;
|
||||
dismiss = TRUE;
|
||||
}
|
||||
|
||||
@@ -348,6 +348,8 @@ curses_block(
|
||||
ret = '\n';
|
||||
else
|
||||
ret = curses_read_char();
|
||||
if (ret == ERR)
|
||||
iflags.term_gone = 1;
|
||||
if (ret == ERR || ret == '\0')
|
||||
ret = '\n';
|
||||
/* msgtype=stop should require space/enter rather than any key,
|
||||
@@ -775,6 +777,7 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
|
||||
|
||||
switch (ch) {
|
||||
case ERR: /* should not happen */
|
||||
iflags.term_gone = 1;
|
||||
*answer = '\0';
|
||||
goto alldone;
|
||||
case '\033': /* DOESCAPE */
|
||||
|
||||
@@ -1026,6 +1026,7 @@ parse_escape_sequence(int key, boolean *keypadnum)
|
||||
ret = getch();
|
||||
|
||||
if (ret == ERR) {
|
||||
iflags.term_gone = 1;
|
||||
/* there was no additional char; treat as M-O or M-^O below */
|
||||
ret = (key == '\033') ? 'O' : C('O');
|
||||
} else if (ret >= 112 && ret <= 121) { /* 'p'..'y' */
|
||||
|
||||
@@ -83,6 +83,8 @@ hooked_tty_getlin(
|
||||
c = pgetchar();
|
||||
term_curs_set(0);
|
||||
if (c == '\033' || c == EOF) {
|
||||
if (c == EOF)
|
||||
iflags.term_gone = 1;
|
||||
if (c == '\033' && obufp[0] != '\0') {
|
||||
obufp[0] = '\0';
|
||||
bufp = obufp;
|
||||
|
||||
@@ -4090,8 +4090,10 @@ tty_nhgetch(void)
|
||||
term_curs_set(0);
|
||||
if (!i)
|
||||
i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */
|
||||
else if (i == EOF)
|
||||
else if (i == EOF) {
|
||||
iflags.term_gone = 1;
|
||||
i = '\033'; /* same for EOF */
|
||||
}
|
||||
/* topline has been seen - we can clear the need for --More-- */
|
||||
if (ttyDisplay && ttyDisplay->toplin == TOPLINE_NEED_MORE)
|
||||
ttyDisplay->toplin = TOPLINE_NON_EMPTY;
|
||||
|
||||
Reference in New Issue
Block a user