nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] minor bug fix for 1.9.99pre1


From: David Lawrence Ramsey
Subject: [Nano-devel] minor bug fix for 1.9.99pre1
Date: Wed, 30 Aug 2006 11:00:19 -0400
User-agent: Thunderbird 1.5.0.5 (X11/20060719)

A few hours after the release, I noticed that the statusbar prompt could
sometimes leave the cursor in the wrong place*.  (I inadvertently
introduced this while attempting to fix statusbar cursor placement when
canceling from one prompt back to another.)  I've fixed this in CVS, and
just in case this is a problem for anyone, I've attached a patch to fix
it in 1.9.99pre1.

* How to reproduce:

1. Run "nano somefilename.txt" at the prompt.

2. Press Ctrl-R to go to the "Insert File" prompt.

3. Type "xxx" at the prompt.

4. Press Home to move the cursor back to the beginning.

5. Press Ctrl-T to go to the file browser.

6. Press Ctrl-_ to go to the "Go To Directory" prompt.

7. Type "xx" at the prompt.

8. Cancel out of the prompt back to the file browser.

9. Cancel out of the file browser back to the "Read File" prompt.

10. Cancel out of the "Read File" prompt back to the edit window.

11. Press Ctrl-O to go to the "Write File" prompt.  The cursor will be
at the beginning of the text instead of the end.

diff -ur nano-1.9.99pre1/src/files.c nano-1.9.99pre1-fixed/src/files.c
--- nano-1.9.99pre1/src/files.c 2006-07-30 21:30:31.000000000 -0400
+++ nano-1.9.99pre1-fixed/src/files.c   2006-08-30 10:49:03.000000000 -0400
@@ -766,13 +766,11 @@
                if (tmp == NULL)
                    continue;
 
+               /* We have a file now.  Indicate this. */
                free(answer);
                answer = tmp;
 
-               /* We have a file now.  Indicate this and get out of the
-                * statusbar prompt cleanly. */
                i = 0;
-               do_prompt_abort();
            }
 #endif
 
@@ -1825,12 +1823,9 @@
                if (tmp == NULL)
                    continue;
 
+               /* We have a file now.  Indicate this. */
                free(answer);
                answer = tmp;
-
-               /* We have a file now.  Get out of the statusbar prompt
-                * cleanly. */
-               do_prompt_abort();
            } else
 #endif /* !DISABLE_BROWSER */
 #ifndef NANO_TINY
diff -ur nano-1.9.99pre1/src/nano.c nano-1.9.99pre1-fixed/src/nano.c
--- nano-1.9.99pre1/src/nano.c  2006-08-28 10:31:29.000000000 -0400
+++ nano-1.9.99pre1-fixed/src/nano.c    2006-08-30 10:49:03.000000000 -0400
@@ -1088,10 +1088,6 @@
     COLS = win.ws_col;
     LINES = win.ws_row;
 
-    /* Just in case we're in the statusbar prompt, reset the statusbar
-     * cursor position. */
-     do_prompt_abort();
-
     /* If we've partitioned the filestruct, unpartition it now. */
     if (filepart != NULL)
        unpartition_filestruct(&filepart);
@@ -2241,6 +2237,10 @@
        }
 #endif
 
+       /* Just in case we were at the statusbar prompt, make sure the
+        * statusbar cursor position is reset. */
+       do_prompt_abort();
+
        /* If constant cursor position display is on, and there are no
         * keys waiting in the input buffer, display the current cursor
         * position on the statusbar. */
diff -ur nano-1.9.99pre1/src/prompt.c nano-1.9.99pre1-fixed/src/prompt.c
--- nano-1.9.99pre1/src/prompt.c        2006-08-26 12:50:51.000000000 -0400
+++ nano-1.9.99pre1-fixed/src/prompt.c  2006-08-30 10:49:03.000000000 -0400
@@ -1247,10 +1247,13 @@
 }
 
 /* This function forces a reset of the statusbar cursor position.  It
- * should only be called after do_prompt(), and is only needed if we
- * leave the prompt via something other than Cancel or Enter. */
+ * should be called when we get out of all statusbar prompts. */
 void do_prompt_abort(void)
 {
+    /* Uninitialize the old cursor position in answer. */
+    old_statusbar_x = (size_t)-1;
+    old_pww = (size_t)-1;
+
     reset_statusbar_x = TRUE;
 }
 

reply via email to

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