add less(1)-style key bindings for up/down to tog; patch by Mikhail
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
diff --git a/tog/tog.1 b/tog/tog.1
index 9ffaae3..5221b4a 100644
--- a/tog/tog.1
+++ b/tog/tog.1
@@ -104,9 +104,9 @@ are as follows:
Move the selection cursor down.
.It Cm Up-arrow, k, <, Comma, Ctrl-p
Move the selection cursor up.
-.It Cm Page-down, Ctrl+f
+.It Cm Page-down, Ctrl+f, d, Ctrl+d
Move the selection cursor down one page.
-.It Cm Page-up, Ctrl+b
+.It Cm Page-up, Ctrl+b, u, Ctrl+u
Move the selection cursor up one page.
.It Cm Home, g
Move the cursor to the newest commit.
@@ -215,9 +215,9 @@ detected.
Scroll down.
.It Cm Up-arrow, k, Ctrl-p
Scroll up.
-.It Cm Page-down, Space, Ctrl+f
+.It Cm Page-down, Space, Ctrl+f, d, Ctrl+d
Scroll down one page.
-.It Cm Page-up, Ctrl+b
+.It Cm Page-up, Ctrl+b, u, Ctrl+u
Scroll up one page.
.It Cm Home, g
Scroll to the top of the view.
@@ -282,9 +282,9 @@ are as follows:
Move the selection cursor down.
.It Cm Up-arrow, k, Ctrl-p
Move the selection cursor up.
-.It Cm Page-down, Space, Ctrl+f
+.It Cm Page-down, Space, Ctrl+f, d, Ctrl+d
Move the selection cursor down one page.
-.It Cm Page-up, Ctrl+b
+.It Cm Page-up, Ctrl+b, u, Ctrl+u
Move the selection cursor up one page.
.It Cm Home, g
Move the selection cursor to the first line of the file.
@@ -361,9 +361,9 @@ are as follows:
Move the selection cursor down.
.It Cm Up-arrow, k, Ctrl-p
Move the selection cursor up.
-.It Cm Page-down, Ctrl+f
+.It Cm Page-down, Ctrl+f, d, Ctrl+d
Move the selection cursor down one page.
-.It Cm Page-up, Ctrl+b
+.It Cm Page-up, Ctrl+b, u, Ctrl+u
Move the selection cursor up one page.
.It Cm Home, g
Move the selection cursor to the first entry.
@@ -431,9 +431,9 @@ are as follows:
Move the selection cursor down.
.It Cm Up-arrow, k, Ctrl-p
Move the selection cursor up.
-.It Cm Page-down, Ctrl+f
+.It Cm Page-down, Ctrl+f, d, Ctrl+d
Move the selection cursor down one page.
-.It Cm Page-up, Ctrl+b
+.It Cm Page-up, Ctrl+b, u, Ctrl+u
Move the selection cursor up one page.
.It Cm Home, g
Move the selection cursor to the first reference.
diff --git a/tog/tog.c b/tog/tog.c
index b4efe82..b3235c1 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2481,6 +2481,8 @@ input_log_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_PPAGE:
case CTRL('b'):
+ case CTRL('u'):
+ case 'u':
if (s->first_displayed_entry == NULL)
break;
if (TAILQ_FIRST(&s->commits.head) == s->first_displayed_entry)
@@ -2529,7 +2531,9 @@ input_log_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
}
case KEY_NPAGE:
- case CTRL('f'): {
+ case CTRL('f'):
+ case CTRL('d'):
+ case 'd': {
struct commit_queue_entry *first;
first = s->first_displayed_entry;
if (first == NULL)
@@ -3787,6 +3791,8 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_PPAGE:
case CTRL('b'):
+ case CTRL('u'):
+ case 'u':
if (s->first_displayed_line == 1)
break;
i = 0;
@@ -3803,6 +3809,8 @@ input_diff_view(struct tog_view **new_view, struct tog_view *view, int ch)
case KEY_NPAGE:
case CTRL('f'):
case ' ':
+ case CTRL('d'):
+ case 'd':
if (s->eof)
break;
i = 0;
@@ -4662,6 +4670,8 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_PPAGE:
case CTRL('b'):
+ case CTRL('u'):
+ case 'u':
if (s->first_displayed_line == 1) {
s->selected_line = 1;
break;
@@ -4816,6 +4826,8 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
case KEY_NPAGE:
case CTRL('f'):
case ' ':
+ case CTRL('d'):
+ case 'd':
if (s->last_displayed_line >= s->blame.nlines &&
s->selected_line >= MIN(s->blame.nlines,
view->nlines - 2)) {
@@ -5600,6 +5612,8 @@ input_tree_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_PPAGE:
case CTRL('b'):
+ case CTRL('u'):
+ case 'u':
if (s->tree == s->root) {
if (got_object_tree_get_first_entry(s->tree) ==
s->first_displayed_entry)
@@ -5625,6 +5639,8 @@ input_tree_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_NPAGE:
case CTRL('f'):
+ case CTRL('d'):
+ case 'd':
if (got_tree_entry_get_next(s->tree, s->last_displayed_entry)
== NULL) {
/* can't scroll any further; move cursor down */
@@ -6413,6 +6429,8 @@ input_ref_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_PPAGE:
case CTRL('b'):
+ case CTRL('u'):
+ case 'u':
if (s->first_displayed_entry == TAILQ_FIRST(&s->refs))
s->selected = 0;
ref_scroll_up(s, MAX(0, view->nlines - 1));
@@ -6431,6 +6449,8 @@ input_ref_view(struct tog_view **new_view, struct tog_view *view, int ch)
break;
case KEY_NPAGE:
case CTRL('f'):
+ case CTRL('d'):
+ case 'd':
if (TAILQ_NEXT(s->last_displayed_entry, entry) == NULL) {
/* can't scroll any further; move cursor down */
if (s->selected < s->ndisplayed - 1)