revise curses_raw_print()

For curses, behave like tty by keeping a count of messages issued via
raw_print, then if that is non-zero issue a prompt and require the
player to acknowledge them before it erases the screen.  Mainly so
that complaints during RC file processing will be seen.

For tty, force getret() to be an unconditional routine instead of
sometimes a routine, sometimes a macro which calls another routine.
This commit is contained in:
PatR
2024-05-17 14:38:17 -07:00
parent 80fb8c77d3
commit d5546d3384
5 changed files with 44 additions and 17 deletions

View File

@@ -207,6 +207,12 @@ curses_init_nhwindows(
#endif
#endif
/* if anything has already been output by nethack (for instance, warnings
about RC file issues), let the player acknowlege it before initscr()
erases the screen */
if (iflags.raw_printed)
curses_wait_synch();
#ifdef XCURSES
base_term = Xinitscr(*argcp, argv);
#else
@@ -853,6 +859,23 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for
void
curses_wait_synch(void)
{
if (iflags.raw_printed) {
int chr;
/*
* If any message has been issued via raw_print(), make the user
* acknowledge it. This might take place before initscr() so
* access to curses is limited. [Despite that, there's probably
* a more curses-specific way to handle this. FIXME?]
*/
(void) fprintf(stdout, "\nPress <return> to continue: ");
(void) fflush(stdout);
do {
chr = fgetc(stdin);
} while (chr > 0 && chr != C('j') && chr != C('m') && chr != '\033');
iflags.raw_printed = 0;
}
if (iflags.window_inited) {
if (curses_got_output())
(void) curses_more();
@@ -1001,12 +1024,11 @@ curses_raw_print(const char *str)
if (iflags.window_inited) {
curses_message_win_puts(str, FALSE);
} else {
puts(str);
return;
}
#else
puts(str);
#endif
puts(str);
iflags.raw_printed++;
}
/*