Fix behavior caused by commit 225d8d38
authorDavid Griffith <dave@661.org>
Sun, 26 May 2019 05:05:52 +0000 (22:05 -0700)
committerDavid Griffith <dave@661.org>
Mon, 27 May 2019 02:32:11 +0000 (19:32 -0700)
Manually copied this over from master because Git somehow lost its place.

src/curses/ux_input.c

index d4f1b67c65e33325a499ee30a5ccc8c45ef4eb66..7f65877eaeb780b2c2d0246d93a5811bfe6a9abe 100644 (file)
@@ -572,6 +572,7 @@ zchar os_read_line (int bufmax, zchar *buf, int timeout, int width,
                     int continued)
 {
     int ch, y, x, len = zcharstrlen(buf);
+    int res;
     const int margin = MAX(h_screen_width - width, 0);
 
     /* These are static to allow input continuation to work smoothly. */
@@ -695,17 +696,20 @@ zchar os_read_line (int bufmax, zchar *buf, int timeout, int width,
            if (searchpos < 0)
                searchpos = len;
            if (ch == ZC_ARROW_UP)
-               unix_history_back(buf, searchpos, max);
+               res = unix_history_back(buf, searchpos, max);
             else
-               unix_history_forward(buf, searchpos, max);
+               res = unix_history_forward(buf, searchpos, max);
 
            scrnset(x, ' ', len);
+           if (res) {
+               scrnset(x, ' ', len);
 #ifdef USE_UTF8
-           utf8_mvaddstr(y, x, buf);
+               utf8_mvaddstr(y, x, buf);
 #else
-           mvaddstr(y, x, (char *)buf);
+               mvaddstr(y, x, (char *)buf);
 #endif
-           scrpos = len = zcharstrlen(buf);
+               scrpos = len = zcharstrlen(buf);
+           }
            continue;
 
        /* Passthrough as up/down arrows for Beyond Zork. */