Fix behavior cuased by commit 225d8d38
authorBill Lash <william.lash@gmail.com>
Sun, 26 May 2019 01:56:44 +0000 (20:56 -0500)
committerBill Lash <william.lash@gmail.com>
Sun, 26 May 2019 01:56:44 +0000 (20:56 -0500)
src/curses/ux_input.c

index 272ee6f63b750b53cf0d51ddae89f4f5963c9768..d6b0015948338aa07ae6503f679afe6b9386b921 100644 (file)
@@ -534,6 +534,7 @@ zchar os_read_line (int bufmax, zchar *buf, int timeout, int width,
                     int continued)
 {
     int ch, y, x, len = strlen( (char *)buf);
+    int res;
     const int margin = MAX(h_screen_width - width, 0);
 
     /* These are static to allow input continuation to work smoothly. */
@@ -657,17 +658,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, (char *) buf);
+               utf8_mvaddstr(y, x, (char *) buf);
 #else
-           mvaddstr(y, x, (char *) buf);
+               mvaddstr(y, x, (char *) buf);
 #endif
-           scrpos = len = strlen((char *) buf);
+               scrpos = len = strlen((char *) buf);
+           }
            continue;
 
        /* Passthrough as up/down arrows for Beyond Zork. */