From 91e8e27718fa765eb09e85374c225136c0b836c6 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sat, 20 May 2006 15:22:28 +0200 Subject: [PATCH] Make Enter in the pager view always scroll It will still split to diff view if a commit line is detected. --- tig.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tig.c b/tig.c index 3b78ef7..7e5f9ae 100644 --- a/tig.c +++ b/tig.c @@ -1564,18 +1564,25 @@ static bool pager_enter(struct view *view) { char *line = view->line[view->lineno]; + int split = 0; - if (view == VIEW(REQ_VIEW_DIFF)) { - scroll_view(view, REQ_SCROLL_LINE_DOWN); - return TRUE; + if ((view == VIEW(REQ_VIEW_LOG) || + view == VIEW(REQ_VIEW_LOG)) && + get_line_type(line) == LINE_COMMIT) { + open_view(view, REQ_VIEW_DIFF, OPEN_SPLIT); + split = 1; } - if (get_line_type(line) == LINE_COMMIT) { - if (view == VIEW(REQ_VIEW_LOG)) - open_view(view, REQ_VIEW_DIFF, OPEN_SPLIT | OPEN_BACKGROUNDED); - else - open_view(view, REQ_VIEW_DIFF, OPEN_DEFAULT); - } + /* Always scroll the view even if it was split. That way + * you can use Enter to scroll through the log view and + * split open each commit diff. */ + scroll_view(view, REQ_SCROLL_LINE_DOWN); + + /* FIXME: A minor workaround. Scrolling the view will call report("") + * but if we are scolling a non-current view this won't properly update + * the view title. */ + if (split) + update_view_title(view); return TRUE; } -- 2.30.2