Code

Fix redrawing of old current line
authorJonas Fonseca <fonseca@diku.dk>
Mon, 11 Sep 2006 23:30:17 +0000 (01:30 +0200)
committerJonas Fonseca <fonseca@antimatter.localdomain>
Mon, 11 Sep 2006 23:30:17 +0000 (01:30 +0200)
Hopefully the last of all this sloppy bug fixing of the recent cleanups.

tig.c

diff --git a/tig.c b/tig.c
index 384fe213809795fde80895612896ce9f25d927ed..398f777a8608803dde95a51fc38846df4e3404bf 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1523,7 +1523,7 @@ scroll_view(struct view *view, enum request request)
 static void
 move_view(struct view *view, enum request request)
 {
-       bool scroll = FALSE;
+       int scroll_steps = 0;
        int steps;
 
        switch (request) {
@@ -1573,19 +1573,18 @@ move_view(struct view *view, enum request request)
        /* Check whether the view needs to be scrolled */
        if (view->lineno < view->offset ||
            view->lineno >= view->offset + view->height) {
+               scroll_steps = steps;
                if (steps < 0 && -steps > view->offset) {
-                       steps = -view->offset;
+                       scroll_steps = -view->offset;
 
                } else if (steps > 0) {
                        if (view->lineno == view->lines - 1 &&
                            view->lines > view->height) {
-                               steps = view->lines - view->offset - 1;
-                               if (steps >= view->height)
-                                       steps -= view->height - 1;
+                               scroll_steps = view->lines - view->offset - 1;
+                               if (scroll_steps >= view->height)
+                                       scroll_steps -= view->height - 1;
                        }
                }
-
-               scroll = TRUE;
        }
 
        if (!view_is_displayed(view)) {
@@ -1598,8 +1597,8 @@ move_view(struct view *view, enum request request)
        if (ABS(steps) < view->height)
                draw_view_line(view, view->lineno - steps - view->offset);
 
-       if (scroll) {
-               do_scroll_view(view, steps);
+       if (scroll_steps) {
+               do_scroll_view(view, scroll_steps);
                return;
        }