Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scroll-half-page-up and scroll-half-page-down actions #1075

Merged
merged 1 commit into from
Jan 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ Cursor Navigation
|Key |Action
|k |Move cursor one line up.
|j |Move cursor one line down.
|PgUp,-,a |Move cursor one page up.
|PgUp, - |Move cursor one page up.
|PgDown, Space |Move cursor one page down.
|End |Jump to last line.
|Home |Jump to first line.
|End |Jump to last line.
|=============================================================================

[[view-scrolling]]
Expand Down
6 changes: 4 additions & 2 deletions doc/tigrc.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,10 @@ Cursor navigation
|=============================================================================
|move-up |Move cursor one line up
|move-down |Move cursor one line down
|move-page-down |Move cursor one page down
|move-page-up |Move cursor one page up
|move-half-page-down |Move cursor half a page down
|move-page-down |Move cursor one page down
|move-half-page-up |Move cursor half a page up
|move-half-page-down |Move cursor half a page down
|move-first-line |Move cursor to first line
|move-last-line |Move cursor to last line
|move-next-merge |Move cursor to next merge commit
Expand All @@ -909,6 +909,8 @@ Scrolling
|scroll-line-down |Scroll one line down
|scroll-page-up |Scroll one page up
|scroll-page-down |Scroll one page down
|scroll-half-page-up |Scroll half a page up
|scroll-half-page-down |Scroll half a page down
|scroll-first-col |Scroll to the first line columns
|scroll-left |Scroll two columns left
|scroll-right |Scroll two columns right
Expand Down
6 changes: 4 additions & 2 deletions include/tig/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
REQ_GROUP("Cursor navigation") \
REQ_(MOVE_UP, "Move cursor one line up"), \
REQ_(MOVE_DOWN, "Move cursor one line down"), \
REQ_(MOVE_PAGE_DOWN, "Move cursor one page down"), \
REQ_(MOVE_PAGE_UP, "Move cursor one page up"), \
REQ_(MOVE_HALF_PAGE_DOWN, "Move cursor half a page down"), \
REQ_(MOVE_PAGE_DOWN, "Move cursor one page down"), \
REQ_(MOVE_HALF_PAGE_UP, "Move cursor half a page up"), \
REQ_(MOVE_HALF_PAGE_DOWN, "Move cursor half a page down"), \
REQ_(MOVE_FIRST_LINE, "Move cursor to first line"), \
REQ_(MOVE_LAST_LINE, "Move cursor to last line"), \
REQ_(MOVE_NEXT_MERGE, "Move cursor to next merge commit"), \
Expand All @@ -63,6 +63,8 @@
REQ_(SCROLL_LINE_DOWN, "Scroll one line down"), \
REQ_(SCROLL_PAGE_UP, "Scroll one page up"), \
REQ_(SCROLL_PAGE_DOWN, "Scroll one page down"), \
REQ_(SCROLL_HALF_PAGE_UP, "Scroll half a page up"), \
REQ_(SCROLL_HALF_PAGE_DOWN, "Scroll half a page down"), \
REQ_(SCROLL_FIRST_COL, "Scroll to the first line columns"), \
REQ_(SCROLL_LEFT, "Scroll two columns left"), \
REQ_(SCROLL_RIGHT, "Scroll two columns right"), \
Expand Down
2 changes: 2 additions & 0 deletions src/tig.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ view_driver(struct view *view, enum request request)
case REQ_SCROLL_LINE_UP:
case REQ_SCROLL_PAGE_DOWN:
case REQ_SCROLL_PAGE_UP:
case REQ_SCROLL_HALF_PAGE_DOWN:
case REQ_SCROLL_HALF_PAGE_UP:
case REQ_SCROLL_WHEEL_DOWN:
case REQ_SCROLL_WHEEL_UP:
scroll_view(view, request);
Expand Down
6 changes: 4 additions & 2 deletions src/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ scroll_view(struct view *view, enum request request)
report_clear();
return;
case REQ_SCROLL_PAGE_DOWN:
lines = view->height;
case REQ_SCROLL_HALF_PAGE_DOWN:
lines = request == REQ_SCROLL_PAGE_DOWN ? view->height : view->height / 2;
/* Fall-through */
case REQ_SCROLL_WHEEL_DOWN:
case REQ_SCROLL_LINE_DOWN:
Expand All @@ -145,7 +146,8 @@ scroll_view(struct view *view, enum request request)
break;

case REQ_SCROLL_PAGE_UP:
lines = view->height;
case REQ_SCROLL_HALF_PAGE_UP:
lines = request == REQ_SCROLL_PAGE_UP ? view->height : view->height / 2;
/* Fall-through */
case REQ_SCROLL_LINE_UP:
case REQ_SCROLL_WHEEL_UP:
Expand Down
4 changes: 2 additions & 2 deletions test/help/all-keybindings-test.expected
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ View manipulation
Cursor navigation
k move-up Move cursor one line up
j move-down Move cursor one line down
<PageDown>, <Space> move-page-down Move cursor one page down
<PageUp>, - move-page-up Move cursor one page up
<Ctrl-D> move-half-page-down Move cursor half a page down
<PageDown>, <Space> move-page-down Move cursor one page down
<Ctrl-U> move-half-page-up Move cursor half a page up
<Ctrl-D> move-half-page-down Move cursor half a page down
<Home> move-first-line Move cursor to first line
<End> move-last-line Move cursor to last line
Scrolling
Expand Down
8 changes: 5 additions & 3 deletions tigrc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ bind generic <C-C> quit # Close all views and quit
bind status u status-update # Stage/unstage changes in file
bind status ! status-revert # Revert changes in file
bind status M status-merge # Open git-mergetool(1)
#bind status ??? :toggle status # Show short or long status labels
# bind status ??? :toggle status # Show short or long status labels
bind stage u status-update # Stage/unstage current diff (c)hunk
bind stage 1 stage-update-line # Stage/unstage current line
bind stage ! status-revert # Revert current diff (c)hunk
Expand Down Expand Up @@ -270,6 +270,8 @@ bind generic <Del> scroll-line-down
bind generic <C-E> scroll-line-down
bind generic <SBack> scroll-page-up
bind generic <SFwd> scroll-page-down
# bind generic ??? scroll-half-page-up
# bind generic ??? scroll-half-page-down

# Searching
bind generic / search
Expand All @@ -295,9 +297,9 @@ bind generic D :toggle date # Toggle date display
bind generic A :toggle author # Toggle author display
bind generic ~ :toggle line-graphics # Toggle (line) graphics mode
bind generic F :toggle file-name # Toggle file name display
# bind generic ??? :toogle show-changes # Toggle local changes display in the main view
# bind generic ??? :toggle show-changes # Toggle local changes display in the main view
bind generic W :toggle ignore-space # Toggle ignoring whitespace in diffs
# bind generic ? :toggle commit-order # Toggle commit ordering
# bind generic ??? :toggle commit-order # Toggle commit ordering
bind generic X :toggle id # Toggle commit ID display
bind generic $ :toggle commit-title-overflow
# Toggle highlighting of commit title overflow
Expand Down