From dfaa6c81e5bb473fa3138f8c4f62b611c4fb7627 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 12 Sep 2006 01:30:17 +0200 Subject: [PATCH] Fix redrawing of old current line Hopefully the last of all this sloppy bug fixing of the recent cleanups. --- tig.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tig.c b/tig.c index 384fe21..398f777 100644 --- 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; } -- 2.30.2