commit aa7a1117140efb46d2d3c82fa22087ea65ec6697 from: Mikhail via: Thomas Adam date: Mon Jan 09 16:06:02 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 - a2f760e6003aa707739f7a5f1cef32af2dffd6c2 commit + aa7a1117140efb46d2d3c82fa22087ea65ec6697 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 - 32f094442105db209ba33dc4657540b9ea984e87 blob + 15a5cd466fc629f86825bbecf97c773f2cfa41d4 --- tog/tog.c +++ tog/tog.c @@ -538,8 +538,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"), \ @@ -3698,6 +3700,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; @@ -3722,6 +3725,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. */ @@ -7355,6 +7359,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; @@ -7365,6 +7370,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; @@ -8275,12 +8281,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;