commit 0b3f028dffa4ecc7aa72dc9132d53e9d056cc36f from: Mikhail via: Mark Jamsek date: Mon Jan 09 13:33: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 accept a prefixed count modifier. Based on initial diff from Mikhail. ok stsp@ commit - 243a8f150f5f79c7530b415ca9df09bdbebd0cf9 commit + 0b3f028dffa4ecc7aa72dc9132d53e9d056cc36f blob - 03eeb1401485cf8cdcd6d8b24b43fdf4f2e44907 blob + 0c91ce65953bf0d1b411b12edff380e5ef1d057e --- tog/tog.1 +++ tog/tog.1 @@ -165,9 +165,9 @@ Move the selection cursor up N 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 @@ If needed, this operation can be cancelled with .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 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 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 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 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;