From 73feb80a00ac04056caca2b2f68da79a90163f6d Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 3 Feb 2024 16:22:45 -0800 Subject: [PATCH] fix #K4097 - ^C during DECgraphics on tty For tty, if ^C interrupt occurred while the terminal was displaying VT line drawing characters, it wouldn't finish updating the map and switch back to regular characters, so the "Really quit?" prompt was illegible. Rather than muck about with the signal handler, just add a fixup to tty_putstr() since prompting ultimately uses putstr(WIN_MESSAGE). Reproducing the situation isn't straightforward; I didn't even try. --- doc/fixes3-7-0.txt | 3 +++ win/tty/wintty.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 9007fa369..c648fd898 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2141,6 +2141,9 @@ tty: have dismiss pick-none menus instead of acting like '>' (not tty: menu search via ':' would clobber part of the menu with a status line refresh if the menu was tall enough to cover that tty: add support for petattr +tty: if a ^C interrupt occurred while DECgraphics characters were being drawn + on the map, the "Really quit?" prompt would be illegible due to being + rendered with VT line drawing characters Unix: when user name is used as default character name, keep hyphenated value intact instead stripping off dash and whatever follows as if that specified role/race/&c (worked once upon a time; broken since 3.3.0) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index a99acdb58..782688392 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2225,6 +2225,16 @@ tty_putstr(winid window, int attr, const char *str) int suppress_history = (attr & ATR_NOHISTORY), urgent_message = (attr & ATR_URGENT); +#if defined(ASCIIGRAPH) && !defined(NO_TERMS) + /* if ^C occurs, player is prompted with "Really quit?" and that + prompt is issued via tty_putstr(WIN_MESSAGE); if ^C happens + while writing DECgraphics chars, the prompt text would be + rendered as VT line-drawing characters unless we do this */ + if (GFlag) { + graph_off(); + GFlag = FALSE; + } +#endif /* if message is designated 'urgent' don't suppress it if user has typed ESC at --More-- prompt when dismissing an earlier message; besides turning off WIN_STOP, we need to prevent current message