]> git.wh0rd.org Git - nano.git/commitdiff
- winio.c:nanogetstr() - Fix problem where pressing down,up,down does not blank the...
authorChris Allegretta <chrisa@asty.org>
Mon, 11 Aug 2003 00:32:45 +0000 (00:32 +0000)
committerChris Allegretta <chrisa@asty.org>
Mon, 11 Aug 2003 00:32:45 +0000 (00:32 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1514 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
winio.c

index e17c6bf60cacf408ca768ac960c1e22672ae1e81..d31d796703f012f89e56a3b0f0278161bb8484cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@ CVS code -
          added at the bottom of the history (but which was not in the
          history) would not be preserved after scrolling down to the
          blank bottom entry and then scrolling back up. (DLR)
+       - Fix problem where pressing down,up,down does not blank the
+         search prompt but keeps the previous search (DLR).
        - Handle Alt-[-F and H (DLR, fixed home and end not working with
          -K in statusbar).  
 - configure.ac:
diff --git a/winio.c b/winio.c
index c699128a47909e69f62b82129cdacf24ddd505de..dd72bcc3c0258d550e7f615dbb8cb1205e4e5321 100644 (file)
--- a/winio.c
+++ b/winio.c
@@ -436,12 +436,15 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
 
                /* otherwise, if currentbuf is NULL and use_cb isn't 2, 
                   it means that we're scrolling down at the bottom of
-                  the search history and the current answer needs to be
-                  saved in currentbuf; do this, blank out answer, and
-                  set use_cb to 2 */
+                  the search history and the current answer (if it's
+                  not blank) needs to be saved in currentbuf; do this,
+                  blank out answer (if necessary), and set use_cb to
+                  2 */
                } else if (use_cb != 2) {
-                   currentbuf = mallocstrcpy(currentbuf, answer);
-                   answer = mallocstrcpy(answer, "");
+                   if (answer[0] != '\0') {
+                       currentbuf = mallocstrcpy(currentbuf, answer);
+                       answer = mallocstrcpy(answer, "");
+                   }
                    xend = 0;
                    use_cb = 2;
                }