In pager mode, fix entering commit lines from log and pager view
[tig] / tig.c
diff --git a/tig.c b/tig.c
index 6c49105..3c267af 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1260,21 +1260,7 @@ open_view(struct view *prev, enum request request, enum open_flags flags)
        bool split = !!(flags & OPEN_SPLIT);
        bool reload = !!(flags & OPEN_RELOAD);
        struct view *view = VIEW(request);
-       struct view *displayed;
-       int nviews;
-
-       /* Cycle between displayed views and count the views. */
-       foreach_view (displayed, nviews) {
-               if (prev != view &&
-                   view == displayed &&
-                   !strcmp(view->vid, prev->vid)) {
-                       current_view = nviews;
-                       /* Blur out the title of the previous view. */
-                       update_view_title(prev);
-                       report("");
-                       return;
-               }
-       }
+       int nviews = display[1] ? 2 : 1;
 
        if (view == prev && nviews == 1 && !reload) {
                report("Already in %s view", view->name);
@@ -1571,7 +1557,7 @@ pager_enter(struct view *view)
        int split = 0;
 
        if ((view == VIEW(REQ_VIEW_LOG) ||
-            view == VIEW(REQ_VIEW_LOG)) &&
+            view == VIEW(REQ_VIEW_PAGER)) &&
            get_line_type(line) == LINE_COMMIT) {
                open_view(view, REQ_VIEW_DIFF, OPEN_SPLIT);
                split = 1;