diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 159e58cfb..dacb4f4a9 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.249 $ $NHDT-Date: 1549334449 2019/02/05 02:40:49 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.250 $ $NHDT-Date: 1549584261 2019/02/08 00:04:21 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -437,6 +437,8 @@ tty: fix leftover display artifact when the last field on the row got placed X11: its use of genl_status_update exposed a negative index use that could lead to a segfault X11: rollback disabling of keystroke input for PICK_NONE menus (for scrolling) +curses: catch up with tty to not put dolook/whatis autodescribe feedback into + ^P message recall (multi-digit count feedback was already handled) Platform- and/or Interface-Specific Fixes or Features diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 72dbc78b8..8ae781a98 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -20,8 +20,9 @@ struct window_procs curses_procs = { #if defined(STATUS_HILITES) | WC2_HILITE_STATUS #endif - | WC2_HITPOINTBAR | WC2_FLUSH_STATUS - | WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR), + | WC2_HITPOINTBAR | WC2_FLUSH_STATUS + | WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR + | WC2_SUPPRESS_HIST), curses_init_nhwindows, curses_player_selection, curses_askname, @@ -377,10 +378,19 @@ Attributes void curses_putstr(winid wid, int attr, const char *text) { - int curses_attr = curses_convert_attr(attr); + int mesgflags, curses_attr; - /* We need to convert NetHack attributes to curses attributes */ - curses_puts(wid, curses_attr, text); + mesgflags = attr & (ATR_URGENT | ATR_NOHISTORY); + attr &= ~mesgflags; + + if (wid == WIN_MESSAGE && (mesgflags & ATR_NOHISTORY) != 0) { + /* display message without saving it in recall history */ + curses_count_window(text); + } else { + /* We need to convert NetHack attributes to curses attributes */ + curses_attr = curses_convert_attr(attr); + curses_puts(wid, curses_attr, text); + } } /* Display the file named str. Complain about missing files @@ -442,7 +452,10 @@ curses_add_menu(winid wid, int glyph, const ANY_P * identifier, CHAR_P accelerator, CHAR_P group_accel, int attr, const char *str, BOOLEAN_P presel) { - int curses_attr = curses_convert_attr(attr); + int curses_attr; + + attr &= ~(ATR_URGENT | ATR_NOHISTORY); + curses_attr = curses_convert_attr(attr); if (inv_update) { curses_add_inv(inv_update, glyph, accelerator, curses_attr, str); diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index fd8c9a875..3f90ed8bc 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -50,10 +50,20 @@ curses_message_win_puts(const char *message, boolean recursed) int border_space = 0; static long suppress_turn = -1; +#if 1 + /* + * Handled by core's use of putstr(WIN_MESSAGE,ATR_NOHISTORY,message) + * for intermediate counts, but get_count() also uses putmsghistory() + * for the final count, to remember that without showing it. But + * curses is using genl_putmsghistory() which just delivers the text + * via a normal pline(). This hides that at cost of not having in + * it ^P recall and being out of sync with DUMPLOG's message history. + */ if (strncmp("Count:", message, 6) == 0) { curses_count_window(message); return; } +#endif if (suppress_turn == moves) { return; @@ -73,7 +83,9 @@ curses_message_win_puts(const char *message, boolean recursed) linespace = ((width + border_space) - 3) - mx; if (strcmp(message, "#") == 0) { /* Extended command or Count: */ - if ((strcmp(toplines, "#") != 0) && (my >= (height - 1 + border_space)) && (height != 1)) { /* Bottom of message window */ + if ((strcmp(toplines, "#") != 0) + /* Bottom of message window */ + && (my >= (height - 1 + border_space)) && (height != 1)) { scroll_window(MESSAGE_WIN); mx = width; my--; @@ -89,7 +101,8 @@ curses_message_win_puts(const char *message, boolean recursed) } if (linespace < message_length) { - if (my >= (height - 1 + border_space)) { /* bottom of message win */ + if (my >= (height - 1 + border_space)) { + /* bottom of message win */ if ((turn_lines > height) || (height == 1)) { /* Pause until key is hit - Esc suppresses any further messages that turn */ @@ -124,8 +137,8 @@ curses_message_win_puts(const char *message, boolean recursed) if (height > 1) { curses_toggle_color_attr(win, NONE, A_BOLD, OFF); } - curses_message_win_puts(tmpstr = curses_str_remainder(message, (width - 2), 1), - TRUE); + tmpstr = curses_str_remainder(message, (width - 2), 1); + curses_message_win_puts(tmpstr, TRUE); free(tmpstr); } else { mvwprintw(win, my, mx, "%s", message); @@ -217,7 +230,7 @@ curses_clear_unhighlight_message_window() /* Reset message window cursor to starting position, and display most -recent messages. */ + recent messages. */ void curses_last_messages() @@ -236,7 +249,7 @@ curses_last_messages() for (i = (num_messages - 1); i > 0; i--) { mesg = get_msg_line(TRUE, i); - if (mesg && mesg->str && strcmp(mesg->str, "")) + if (mesg && mesg->str && *mesg->str) curses_message_win_puts(mesg->str, TRUE); } curses_message_win_puts(toplines, TRUE); @@ -293,8 +306,10 @@ curses_prev_mesg() } -/* Shows Count: at the bottom of the message window, - popup_dialog is not currently implemented for this function */ +/* Display at the bottom of the message window without remembering the + line for ^P recall. Used for putstr(WIN_MESSAGE,ATR_NOHISTORY,text) + which core currently uses for 'Count: 123' and dolook's autodescribe. + popup_dialog is not currently implemented for this function. */ void curses_count_window(const char *count_text) @@ -303,13 +318,12 @@ curses_count_window(const char *count_text) int messageh, messagew; static WINDOW *countwin = NULL; - if ((count_text == NULL) && (countwin != NULL)) { - delwin(countwin); - countwin = NULL; + if (!count_text) { + if (countwin) + delwin(countwin), countwin = NULL; counting = FALSE; return; } - counting = TRUE; curses_get_window_xy(MESSAGE_WIN, &winx, &winy); @@ -322,18 +336,14 @@ curses_count_window(const char *count_text) winy += messageh - 1; - if (countwin == NULL) { -#ifndef PDCURSES - countwin = newwin(1, 25, winy, winx); -#endif /* !PDCURSES */ - } #ifdef PDCURSES - else { - curses_destroy_win(countwin); - } - - countwin = newwin(1, 25, winy, winx); + if (countwin) + curses_destroy_win(countwin), countwin = NULL; #endif /* PDCURSES */ + /* this used to specify a width of 25; that was adequate for 'Count: 123' + but not for dolook's autodescribe when it refers to a named monster */ + if (!countwin) + countwin = newwin(1, messagew, winy, winx); startx = 0; starty = 0; diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 0c47d775d..c20138453 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -632,7 +632,7 @@ curses_get_count(int first_digit) current_count = LARGEST_INT; } - pline("Count: %ld", current_count); + custompline(SUPPRESS_HISTORY, "Count: %ld", current_count); current_char = curses_read_char(); } @@ -647,13 +647,17 @@ curses_get_count(int first_digit) /* Convert the given NetHack text attributes into the format curses -understands, and return that format mask. */ + understands, and return that format mask. */ int curses_convert_attr(int attr) { int curses_attr; + /* first, strip off control flags masked onto the display attributes + (caller should have already done this...) */ + attr &= ~(ATR_URGENT | ATR_NOHISTORY); + switch (attr) { case ATR_NONE: curses_attr = A_NORMAL;