"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mikhail <mp39590@gmail.com>
Subject:
u/ctrl-u/d/ctrl-d bindings for scrolling in tog
To:
gameoftrees@openbsd.org
Date:
Sat, 11 Jun 2022 18:23:20 +0300

Download raw body.

Thread
I try to switch from got log/got diff -c workflow to tog, and I miss
'less' bindings which I used to use.

Can they be added?

diff 3ef807eedd4fec23cf457ea7cd55bc01407d57b9 /home/misha/work/got
blob - 9ffaae36730332eea4010cd1a92aca8e2ad8117a
file + tog/tog.1
--- tog/tog.1
+++ 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.
blob - b4efe82ad2000b743da8b7312623bf0fe3708969
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -2481,6 +2481,8 @@ input_log_view(struct tog_view **new_view, struct tog_
 		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_
 		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
 		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
 	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 to
 		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 to
 	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
 		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
 		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_
 		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_
 		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)