tog: add support for navigating to first/last line of blame view ok tracey stsp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/tog/tog.1 b/tog/tog.1
index 58534fe..e146064 100644
--- a/tog/tog.1
+++ b/tog/tog.1
@@ -286,6 +286,10 @@ Move the selection cursor up.
Move the selection cursor down one page.
.It Cm Page-up, Ctrl+b
Move the selection cursor up one page.
+.It Cm Home, g
+Move the selection cursor to the first line of the file.
+.It Cm End, G
+Move the selection cursor to the last line of the file.
.It Cm Enter
Open a
.Cm diff
diff --git a/tog/tog.c b/tog/tog.c
index b9c4abb..676aa5b 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -4532,6 +4532,22 @@ input_blame_view(struct tog_view **new_view, struct tog_view *view, int ch)
case 'q':
s->done = 1;
break;
+ case 'g':
+ case KEY_HOME:
+ s->selected_line = 1;
+ s->first_displayed_line = 1;
+ break;
+ case 'G':
+ case KEY_END:
+ if (s->blame.nlines < view->nlines - 2) {
+ s->selected_line = s->blame.nlines;
+ s->first_displayed_line = 1;
+ } else {
+ s->selected_line = view->nlines - 2;
+ s->first_displayed_line = s->blame.nlines -
+ (view->nlines - 3);
+ }
+ break;
case 'k':
case KEY_UP:
if (s->selected_line > 1)