From: Jonas Fonseca Date: Sat, 20 May 2006 13:22:28 +0000 (+0200) Subject: Make Enter in the pager view always scroll X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=91e8e27718fa765eb09e85374c225136c0b836c6;p=tig.git Make Enter in the pager view always scroll It will still split to diff view if a commit line is detected. --- 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; }