Code

Workaround bug exposed by the redrawwin removal in do_scroll_view
authorJonas Fonseca <fonseca@diku.dk>
Fri, 30 Jan 2009 08:24:24 +0000 (09:24 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Fri, 30 Jan 2009 08:26:01 +0000 (09:26 +0100)
The bug means that the message from scrolling up one line when
impossible followed by scrolling down one line is not removed by the
next action.

Workaround this by inserting an extra call to report("") before the call
to wrefresh().

tig.c

diff --git a/tig.c b/tig.c
index 146bd7021d1dd78d457c197221e648856fadf194..2a909b608b1893bc6c43c52175b4e26afdc71296 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2274,16 +2274,19 @@ do_scroll_view(struct view *view, int lines)
                wscrl(view->win, lines);
                scrollok(view->win, FALSE);
 
-               for (; line < end; line++) {
-                       if (!draw_view_line(view, line))
-                               break;
-               }
+               while (line < end && draw_view_line(view, line))
+                       line++;
 
                if (redraw_current_line)
                        draw_view_line(view, view->lineno - view->offset);
+               /* FIXME: Stupid hack to workaround bug where the message from
+                * scrolling up one line when impossible followed by scrolling
+                * down one line is not removed by the next action. */
+               if (lines > 0)
+                       report("");
+               wrefresh(view->win);
        }
 
-       wrefresh(view->win);
        report("");
 }