From: Stefan Sperling Subject: Re: tog: = and * keybindings for and respectively To: Mark Jamsek Cc: Mikhail , gameoftrees@openbsd.org Date: Sun, 8 Jan 2023 15:34:23 +0100 On Sun, Jan 08, 2023 at 11:27:22PM +1100, Mark Jamsek wrote: > I think this is ok. > > Part of me was a bit conflicted about splitting g/home G/end in tog's > runtime help, but it's certainly correct. It felt a bit like stating the > obvious at the expense of complicating a reference text but we couldn't > blame someone for wondering why N Home/End doesn't go to line N when the > runtime help says as much! > > I also think only g/G should accept count modifiers. N home/end doesn't > make sense to me, so Mikhail's proposed separation is the right way to > go. > > We should, however, do the same in tog(1) because I think that should be > the most comprehensive documentation, where tog H is only a reference. > The below diff expands on Mikhail's by continuing the g/G home/end > separation in tog.1: Yes, agreed on everything. Thanks! ok stsp > ----------------------------------------------- > commit 51c92c51612632debff47151de8fd0b3eff7f243 (main) > from: Mark Jamsek > date: Sun Jan 8 12:15:35 2023 UTC > > tog: add mutt-like =/* keymaps as home/end aliases > > Also, separate g/G from home/end in the manual and runtime help text as only > the former accepts a prefixed count modifier. Based on diff from Mikhail. > > M tog/tog.1 | 40+ 10- > M tog/tog.c | 10+ 2- > > 2 files changed, 50 insertions(+), 12 deletions(-) > > diff dae92a245f6e4d18c4c75048d6ca667d78083cc4 51c92c51612632debff47151de8fd0b3eff7f243 > commit - dae92a245f6e4d18c4c75048d6ca667d78083cc4 > commit + 51c92c51612632debff47151de8fd0b3eff7f243 > blob - 03eeb1401485cf8cdcd6d8b24b43fdf4f2e44907 > blob + 0c91ce65953bf0d1b411b12edff380e5ef1d057e > --- 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, = > Move the cursor to the newest commit. > -.It Cm End, G > +.It Cm End, * > 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. > @@ -175,6 +175,12 @@ or > .Cm C-g > or > .Cm Backspace . > +.It Cm g > +Move the cursor to commit N (default: 1). > +.It Cm G > +Like > +.Cm g > +but defaults to the oldest commit. > .It Cm Enter > Open a > .Cm diff > @@ -327,10 +333,16 @@ Scroll up N half pages (default: 1). > Scroll down N half pages (default: 1). > .It Cm Ctrl+u, u > Scroll up N half pages (default: 1). > -.It Cm Home, g > +.It Cm Home > Scroll to the top of the view. > -.It Cm End, G > +.It Cm End > Scroll to the bottom of the view. > +.It Cm g > +Scroll to line N (default: 1). > +.It Cm G > +Like > +.Cm g > +but defaults to the last line in the diff. > .It Cm \&( > Navigate to the Nth previous file in the diff (default: 1). > .It Cm \&) > @@ -438,10 +450,16 @@ 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 > Move the selection cursor to the first line of the file. > -.It Cm End, G > +.It Cm End > Move the selection cursor to the last line of the file. > +.It Cm g > +Move the selection cursor to line N (default: 1). > +.It Cm G > +Like > +.Cm g > +but defaults to the last line in the file. > .It Cm Enter > Open a > .Cm diff > @@ -538,10 +556,16 @@ 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, = > Move the selection cursor to the first entry. > -.It Cm End, G > +.It Cm End, * > Move the selection cursor to the last entry. > +.It Cm g > +Move the selection cursor to entry N (default: 1). > +.It Cm G > +Like > +.Cm g > +but defaults to the last entry. > .It Cm Enter > Enter the currently selected directory, or switch to the > .Cm blame > @@ -614,10 +638,16 @@ 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, = > Move the selection cursor to the first reference. > -.It Cm End, G > +.It Cm End, * > Move the selection cursor to the last reference. > +.It Cm g > +Move the selection cursor to reference N (default: 1). > +.It Cm G > +Like > +.Cm g > +but defaults to the last reference. > .It Cm Enter > Open a > .Cm log > blob - 7a91723cf327c438d7801b8d486b165bd84ba1ea > blob + d3d296f8b7c8ece84d0d00349fe8949bb2ca9eeb > --- 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; > > > -- > Mark Jamsek > GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68