"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
tog: add g/G support to blame view
To:
gameoftrees@openbsd.org
Date:
Wed, 1 Sep 2021 22:09:01 +0200

Download raw body.

Thread
tog: add support for navigating to first/last line of blame view

ok?

diff refs/heads/main refs/heads/home+end
blob - 58534fe277ad32465d58137945ff09a982d891b2
blob + e1460641f9ff41fe9c556f72f3433b6b500e9dc9
--- tog/tog.1
+++ 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
blob - b9c4abb82f4c3a2becb00e1847dfbb0ef461c37e
blob + 676aa5bfd38d46389ada9f6d333fc7b1eab64913
--- tog/tog.c
+++ tog/tog.c
@@ -4532,6 +4532,22 @@ input_blame_view(struct tog_view **new_view, struct to
 	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)
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de