]> granicus.if.org Git - nethack/commitdiff
curses message window vs prompting
authorPatR <rankin@nethack.org>
Fri, 24 May 2019 08:33:45 +0000 (01:33 -0700)
committerPatR <rankin@nethack.org>
Fri, 24 May 2019 08:33:45 +0000 (01:33 -0700)
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
win/curses/cursmesg.c

index dc0c5c8a8755dbccbb2f8ced5a85e0a35622a9d1..5ff4a18504e387a8c581834d17dfa33d15cefa1a 100644 (file)
@@ -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
index ab22a25862ca6cee99375b205d3540c4348b3521..0d67cff1c0397ba0dadb583ce6f21740f78e992b 100644 (file)
@@ -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