From c5544a80117ae5ec2988103da199a39ee4d65cb3 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 18 Dec 2021 11:07:23 -0800 Subject: [PATCH] 'urgent' messages for curses Have curses catch up with tty. Some particular messages override message suppression after --More-ESC (tty) or >>ESC (curses). --- doc/fixes37.0 | 2 ++ win/curses/cursmain.c | 7 ++++++- win/curses/cursmesg.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 8c558e278..d8312ebd3 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1299,6 +1299,8 @@ curses: implement selecting menu items via mouse curses: 'windowborders' can be set to 3 or 4 to suppress perm_invent borders to provide slightly more room for actual inventory info curses: if panictrace is triggered, reset the terminal before giving backtrace +curses: if a message is marked urgent, override message suppression initiated + by user having typed ESC at previous More>> prompt Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings" dialog box ("Preferences..." on OSX) Qt: draw a border around each tile in the paper doll inventory; when BUC is diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 6e9d73407..da04e639f 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -48,7 +48,7 @@ struct window_procs curses_procs = { #endif | WC2_FLUSH_STATUS | WC2_TERM_SIZE | WC2_STATUSLINES | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR - | WC2_SUPPRESS_HIST | WC2_MENU_SHIFT), + | WC2_SUPPRESS_HIST | WC2_URGENT_MESG | WC2_MENU_SHIFT), {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */ curses_init_nhwindows, curses_player_selection, @@ -498,6 +498,11 @@ curses_putstr(winid wid, int attr, const char *text) mesgflags = attr & (ATR_URGENT | ATR_NOHISTORY); attr &= ~mesgflags; + /* this is comparable to tty's cw->flags &= ~WIN_STOP; if messages are + being suppressed after >>ESC, override that and resume showing them */ + if ((mesgflags & ATR_URGENT) != 0) + curs_mesg_suppress_turn = -1L; + if (wid == WIN_MESSAGE && (mesgflags & ATR_NOHISTORY) != 0) { /* display message without saving it in recall history */ curses_count_window(text); diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 68a8d389f..150436052 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -20,7 +20,7 @@ extern char erase_char, kill_char; /* player can type ESC at More>> prompt to avoid seeing more messages for the current move; but hero might get more than one move per turn, so the input routines need to be able to cancel this */ -long curs_mesg_suppress_turn = -1; +long curs_mesg_suppress_turn = -1L; /* Message window routines for curses interface */ @@ -166,7 +166,7 @@ void curses_got_input(void) { /* if messages are being suppressed, reenable them */ - curs_mesg_suppress_turn = -1; + curs_mesg_suppress_turn = -1L; /* misleadingly named; represents number of lines delivered since player was sure to have had a chance to read them; if player