From: Pierre Habouzit Date: Thu, 24 Jun 2010 15:24:24 +0000 (+0200) Subject: Add a scroll-first-col command X-Git-Url: https://git.tokkee.org/?p=tig.git;a=commitdiff_plain;h=5b1f4fe12444f406fc16d8cfa423710960cc30ce Add a scroll-first-col command Signed-off-by: Pierre Habouzit [ jf: fix built-in description and add entry to the manual ] Signed-off-by: Jonas Fonseca --- diff --git a/NEWS b/NEWS index 1a0960a..61d6c88 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,11 @@ Release notes tig master ---------- +Improvements: + + - Add scroll-first-col action to jump to the first column. Bound to '|' + by default. + Bug fixes: - Fix problem with empty diff views when file specs were passed on the diff --git a/manual.txt b/manual.txt index f6a13d5..ffea349 100644 --- a/manual.txt +++ b/manual.txt @@ -352,6 +352,7 @@ Scrolling |s |Scroll view one page down. |Left |Scroll view one column left. |Right |Scroll view one column right. +|\| |Scroll view to the first column. |============================================================================= [[searching]] diff --git a/tig.c b/tig.c index 90c2fc1..903efde 100644 --- a/tig.c +++ b/tig.c @@ -1136,6 +1136,7 @@ io_run_load(const char **argv, const char *separators, REQ_(MOVE_LAST_LINE, "Move cursor to last line"), \ \ REQ_GROUP("Scrolling") \ + REQ_(SCROLL_FIRST_COL, "Scroll to the first line columns"), \ REQ_(SCROLL_LEFT, "Scroll two columns left"), \ REQ_(SCROLL_RIGHT, "Scroll two columns right"), \ REQ_(SCROLL_LINE_UP, "Scroll one line up"), \ @@ -1458,6 +1459,7 @@ static struct keybinding default_keybindings[] = { { '-', REQ_MOVE_PAGE_UP }, /* Scrolling */ + { '|', REQ_SCROLL_FIRST_COL }, { KEY_LEFT, REQ_SCROLL_LEFT }, { KEY_RIGHT, REQ_SCROLL_RIGHT }, { KEY_IC, REQ_SCROLL_LINE_UP }, @@ -2901,6 +2903,11 @@ scroll_view(struct view *view, enum request request) assert(view_is_displayed(view)); switch (request) { + case REQ_SCROLL_FIRST_COL: + view->yoffset = 0; + redraw_view_from(view, 0); + report(""); + return; case REQ_SCROLL_LEFT: if (view->yoffset == 0) { report("Cannot scroll beyond the first column"); @@ -3695,6 +3702,7 @@ view_driver(struct view *view, enum request request) move_view(view, request); break; + case REQ_SCROLL_FIRST_COL: case REQ_SCROLL_LEFT: case REQ_SCROLL_RIGHT: case REQ_SCROLL_LINE_DOWN: diff --git a/tigrc.5.txt b/tigrc.5.txt index 6c88563..df48749 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -304,6 +304,7 @@ put in either the .gitconfig or .git/config file: |scroll-line-down |Scroll one line down |scroll-page-up |Scroll one page up |scroll-page-down |Scroll one page down +|scroll-first-col |Scroll to the first column |scroll-left |Scroll one column left |scroll-right |Scroll one column right |=============================================================================