]> granicus.if.org Git - nethack/commitdiff
curses getline()
authorPatR <rankin@nethack.org>
Tue, 28 May 2019 09:27:40 +0000 (02:27 -0700)
committerPatR <rankin@nethack.org>
Tue, 28 May 2019 09:27:40 +0000 (02:27 -0700)
After going back and forth between prompts causing message lines
to be overwritten and to be skipped, this yoyo might have finally
run out of string.  Fingers crossed....

doc/fixes36.3
win/curses/cursmesg.c

index ba04dc4d3016f13d30e1c8935dc77351d96e9ed4..05ed99bd2b2bd2d0a8ef82f88bb42471a2c3cd31 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.24 $ $NHDT-Date: 1558921075 2019/05/27 01:37:55 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.25 $ $NHDT-Date: 1559035655 2019/05/28 09:27:35 $
 
 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,
@@ -57,6 +57,8 @@ curses: when display windows get reconfigured (after setting align_status,
        when feasible it combines short lines, resulting in N messages on
        fewer than N lines and leaving some of the available lines blank.]
 curses: plug memory leak when getting a line of input is cancelled by ESC
+curses: after requesting a line of input from player, next line of message
+       window could end up being skipped
 tty: re-do one optimization used when status conditions have all been removed
        and remove another that tried to check whether condition text to be
        displayed next was the same as the existing value; sometimes new
index e006bd76f670b205adefda96ce33c36135993ed6..d752223fa1a7114474ccada005899deba2b35e3e 100644 (file)
@@ -584,6 +584,9 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
 #endif
         curs_set(0);
         switch (ch) {
+        case ERR: /* should not happen */
+            *answer = '\0';
+            goto alldone;
         case '\033': /* DOESCAPE */
             /* if there isn't any input yet, return ESC */
             if (len == 0) {
@@ -610,20 +613,25 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
             *p_answer = '\0';
             len = 0;
             break;
-        case ERR: /* should not happen */
-            *answer = '\0';
-            goto alldone;
         case '\r':
         case '\n':
             (void) strncpy(answer, p_answer, buffer);
             answer[buffer - 1] = '\0';
             Strcpy(toplines, tmpbuf);
             mesg_add_line(tmpbuf);
+#if 1
+            /* position at end of current line so next message will be
+               written on next line regardless of whether it could fit here */
+            mx = border_space ? (width + 1) : (width - 1);
+            wmove(win, my, mx);
+#else       /* after various other changes, this resulted in getline()
+             * prompt+answer being following by a blank message line */
             if (++my > maxy) {
                 scroll_window(MESSAGE_WIN);
                 my--;
             }
             mx = border_space;
+#endif /*0*/
             goto alldone;
         case '\177': /* DEL/Rubout */
         case KEY_DC: /* delete-character */