nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] bug fix: scrolling down in history


From: David Lawrence Ramsey
Subject: [Nano-devel] bug fix: scrolling down in history
Date: Fri, 8 Aug 2003 21:42:01 -0700 (PDT)

I just discovered a minor bug in the down-arrow routine at the statusbar
prompt:

1. Go to the search prompt, enter any word, and press Enter.  This
ensures that there's at least one history entry.

2, Go to the search prompt again.  You should now be at the blank line
at the bottom of the history list.

3. Press down, then up.  The word you added to the history should be
back at the statusbar prompt.

4. Press down again.  You should go back to the blank line at the bottom
of the history list, but instead the word you added to the history stays
at the prompt, and you can't scroll down past it.

The problem appears to be that the value of answer is always saved in
currentbuf when scrolling down at the blank line at the bottom of the
history list.  This means that your pressing down at that blank line
saves "" in currentbuf when it shouldn't.  The attached patch fixes that
by not saving answer in currentbuf and then blanking it out if answer is
already blank beforehand.


_____________________________________________________________
Sluggy.Net: The Sluggy Freelance Community!
diff -urN nano/winio.c nano-fixed/winio.c
--- nano/winio.c        2003-08-05 15:31:12.000000000 -0400
+++ nano-fixed/winio.c  2003-08-09 00:25:45.000000000 -0400
@@ -436,12 +436,15 @@
 
                /* 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;
                }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]