nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] 1.1.10/cvs scroll bug and crash (patch)


From: Jeff DeFouw
Subject: [Nano-devel] 1.1.10/cvs scroll bug and crash (patch)
Date: Sun, 18 Aug 2002 22:33:21 -0500
User-agent: Mutt/1.4i

Bug #1: Scrolling up (non-smooth) when at the top of the edit window
attempts to go up two lines.  That doesn't make sense, but more
importantly that results in a segmentation fault when on the second line
of the file.  One way to reproduce: turn on smooth scrolling, scroll the
edit window down one line, and then turn smooth scrolling off and try to
scroll back with the up-arrow.  current is updated twice (first in
edit_update), the second time it's set to NULL.

Bug #2: When the edit window is on the last line of the file and the
down-arrow is used, the cursor is placed in the center of the screen
without changing the edit window contents.  Since there is no next line,
edit_update refuses to do anything.  Using the current line works
(behaves like pico).  One way to reproduce: In a 24-line terminal, open
a 19-line file, and down-arrow to the end.

This patch fixes both bugs and applies to current CVS and 1.1.10.

--- move.c.orig 2002-08-18 18:31:10.000000000 -0500
+++ move.c      2002-08-18 22:12:21.000000000 -0500
@@ -105,10 +105,8 @@
               line and don't center it. */
            if (edittop != fileage)
                center_cursor();
-           else {
-               current = current->prev;
+           else
                reset_cursor();
-           }
        }
     } else
        current_y = 0;
@@ -186,8 +184,10 @@
        } else
 #endif
        {
-           edit_update(editbot->next, CENTER);
-               /* sets edittop so editbot->next is centered */
+           edit_update(editbot->next != NULL ? editbot->next : editbot,
+               CENTER);
+               /* sets edittop so editbot->next (or else editbot) is
+                * centered */
            center_cursor();
                /* sets current_y = editwinrows / 2 */
        }

-- 
Jeff DeFouw <address@hidden>




reply via email to

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