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:
Pasi Kallinen
2025-07-12 18:21:09 +03:00
parent 65774372e6
commit e240efa10b
11 changed files with 28 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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' */