From ba5efe7f61598b731f7c8d0c28ecc43e2a978061 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 24 May 2019 01:33:45 -0700 Subject: [PATCH] curses message window vs prompting Fix a problem introduced by f218e3f15e2d5525e817fb07e6a8b4773f296073 and/or a19e64e470f21ef30b96122dd2d40c26ef9b1527. Sometimes the line after a prompt would be empty and the next message get shown on the line after that. a19e64e470 was intended to fix the opposite problem so probably overshot the mark.... --- doc/fixes36.3 | 3 ++- win/curses/cursmesg.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index dc0c5c8a8..5ff4a1850 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.14 $ $NHDT-Date: 1558662976 2019/05/24 01:56:16 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.15 $ $NHDT-Date: 1558686805 2019/05/24 08:33:25 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -22,6 +22,7 @@ xans fly, but could not reach your feet if you flew Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository ------------------------------------------------------------------ +curses: sometimes the message window would show a blank line after a prompt Platform- and/or Interface-Specific Fixes or Features diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index ab22a2586..0d67cff1c 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -290,17 +290,18 @@ curses_last_messages() * to start and stop because curses_message_win_puts() combines short * lines. So we can end up with blank lines at bottom of the message * window, missing out on one or more older messages which could have - * been included at the top. + * been included at the top. Also long messages might wrap and take + * more than one line apiece. * - * 3.6.2 showed oldest available N lines (by starting at + * 3.6.2 showed oldest available N-1 lines (by starting at * num_mesages - 1 and working back toward 0 until window height was - * reached [via index 'j' which is gone now]) rather than most recent - * N (start at height - 1 and work way up through 0) so showed wrong - * lines even if N lines had been the right way to handle this. + * reached [via index 'j' which is gone now]) plus the latest line + * (via toplines[]), rather than most recent N (start at height - 1 + * and work way up through 0). So it showed wrong subset of lines + * even if 'N lines' had been the right way to handle this. */ ++last_messages; - i = min(height, num_messages) - 1; - for ( ; i > 0; --i) { + for (i = min(height, num_messages) - 1; i > 0; --i) { mesg = get_msg_line(TRUE, i); if (mesg && mesg->str && *mesg->str) curses_message_win_puts(mesg->str, TRUE); @@ -417,7 +418,7 @@ curses_count_window(const char *count_text) /* if most recent message (probably prompt leading to this instance of counting window) is going to be covered up, scroll mesgs up a line */ - if (!counting && my >= border + (messageh - 1)) { + if (!counting && my == border + (messageh - 1) && mx > border) { scroll_window(MESSAGE_WIN); if (messageh > 1) { /* handling for next message will behave as if we're currently -- 2.40.0