Download raw body.
tog: = and * keybindings for <home> and <end> respectively
On Sun, Jan 08, 2023 at 09:47:28AM +0100, Stefan Sperling wrote:
> On Sat, Jan 07, 2023 at 10:17:37PM +0300, Mikhail wrote:
> > While in tog I keep pressing those keys just like I'd do in mutt, since
> > 'tog log' view is more like mutt for me than like 'less'. Since we have
> > J and K for tog diff, which mimics mutt's next/prev email, maybe such
> > keybindings can be used too?
>
> Mutt is using these keys for all "entry-based" menus.
> I would say if we add these keys then they should also work in all
> entry-based menus supported by tog, i.e. log, tree, and ref.
I agree, next version below, also added new entries for F1 menu and
split g/G from Home/End, since currently only g/G moves to selected
line, pressing 3Home or 3End jumps to first or end line unconditionally.
diff /home/misha/work/got
commit - 1a99e0b4097b26cac736de07239a3be7589a48f7
path + /home/misha/work/got
blob - 03eeb1401485cf8cdcd6d8b24b43fdf4f2e44907
file + tog/tog.1
--- tog/tog.1
+++ tog/tog.1
@@ -165,9 +165,9 @@ Move the selection cursor up N half pages (default: 1)
Move the selection cursor down N half pages (default: 1).
.It Cm Ctrl+u, u
Move the selection cursor up N half pages (default: 1).
-.It Cm Home, g
+.It Cm Home, g, =
Move the cursor to the newest commit.
-.It Cm End, G
+.It Cm End, G, *
Move the cursor to the oldest commit.
This will traverse all commits on the current branch which may take
a long time depending on the number of commits in branch history.
@@ -538,9 +538,9 @@ Move the selection cursor up N half pages (default: 1)
Move the selection cursor down N half pages (default: 1).
.It Cm Ctrl+u, u
Move the selection cursor up N half pages (default: 1).
-.It Cm Home, g
+.It Cm Home, g, =
Move the selection cursor to the first entry.
-.It Cm End, G
+.It Cm End, G, *
Move the selection cursor to the last entry.
.It Cm Enter
Enter the currently selected directory, or switch to the
@@ -614,9 +614,9 @@ Move the selection cursor up N half pages (default: 1)
Move the selection cursor down N half pages (default: 1).
.It Cm Ctrl+u, u
Move the selection cursor up N half pages (default: 1).
-.It Cm Home, g
+.It Cm Home, g, =
Move the selection cursor to the first reference.
-.It Cm End, G
+.It Cm End, G, *
Move the selection cursor to the last reference.
.It Cm Enter
Open a
blob - 7a91723cf327c438d7801b8d486b165bd84ba1ea
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -533,8 +533,10 @@ struct tog_help_view_state {
KEY_("C-f f PgDn Space", "Scroll the view down one page"), \
KEY_("C-u u", "Scroll the view up one half page"), \
KEY_("C-d d", "Scroll the view down one half page"), \
- KEY_("g Home", "Go to line N (default: first line)"), \
- KEY_("G End", "Go to line N (default: last line)"), \
+ KEY_("g", "Go to line N (default: first line)"), \
+ KEY_("Home =", "Go to the first line"), \
+ KEY_("G", "Go to line N (default: last line)"), \
+ KEY_("End *", "Go to the last line"), \
KEY_("l Right", "Scroll the view right"), \
KEY_("h Left", "Scroll the view left"), \
KEY_("$", "Scroll view to the rightmost position"), \
@@ -3693,6 +3695,7 @@ input_log_view(struct tog_view **new_view, struct tog_
log_move_cursor_up(view, 0, 0);
break;
case 'g':
+ case '=':
case KEY_HOME:
log_move_cursor_up(view, 0, 1);
view->count = 0;
@@ -3717,6 +3720,7 @@ input_log_view(struct tog_view **new_view, struct tog_
s->use_committer = !s->use_committer;
break;
case 'G':
+ case '*':
case KEY_END: {
/* We don't know yet how many commits, so we're forced to
* traverse them all. */
@@ -7350,6 +7354,7 @@ input_tree_view(struct tog_view **new_view, struct tog
err = view_request_new(new_view, view, TOG_VIEW_REF);
break;
case 'g':
+ case '=':
case KEY_HOME:
s->selected = 0;
view->count = 0;
@@ -7360,6 +7365,7 @@ input_tree_view(struct tog_view **new_view, struct tog
s->first_displayed_entry = NULL;
break;
case 'G':
+ case '*':
case KEY_END: {
int eos = view->nlines - 3;
@@ -8270,12 +8276,14 @@ input_ref_view(struct tog_view **new_view, struct tog_
err = view_request_new(new_view, view, TOG_VIEW_TREE);
break;
case 'g':
+ case '=':
case KEY_HOME:
s->selected = 0;
view->count = 0;
s->first_displayed_entry = TAILQ_FIRST(&s->refs);
break;
case 'G':
+ case '*':
case KEY_END: {
int eos = view->nlines - 1;
tog: = and * keybindings for <home> and <end> respectively