Avoid flickering when moving past the main view's first and last line
authorWitold Filipczyk <witekfl@poczta.onet.pl>
Wed, 8 Aug 2007 12:39:22 +0000 (14:39 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Wed, 8 Aug 2007 12:39:30 +0000 (14:39 +0200)
In diff mode when first or last item is displayed KEY_UP or KEY_DOWN
respectively cause flickering. I know that I should not press
those keys in that situation, but this annoys me anyway.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c

diff --git a/tig.c b/tig.c
index fa2a708..465de23 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2177,10 +2177,15 @@ view_driver(struct view *view, enum request request)
                     view->parent == VIEW(REQ_VIEW_MAIN)) ||
                   (view == VIEW(REQ_VIEW_BLOB) &&
                     view->parent == VIEW(REQ_VIEW_TREE))) {
+                       int line;
+
                        view = view->parent;
+                       line = view->lineno;
                        move_view(view, request);
                        if (view_is_displayed(view))
                                update_view_title(view);
+                       if (line == view->lineno)
+                               break;
                } else {
                        move_view(view, request);
                        break;