Commit Diff


commit - 6480c871c8f9ffdce90c10e7a7313e1187de019a
commit + 912a3f7945204384e4aa755c41dd4e89a855ef38
blob - e22d9079c1fe6f5a46d0cdde8ff7194c27c56088
blob + 3d45c560c4bb01de1b6dee76d385939f0928c426
--- tog/tog.1
+++ tog/tog.1
@@ -108,6 +108,12 @@ 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, Ctrl-u
+Move the cursor to the newest commit.
+.It Cm End, G
+Move the cursor to the oldest commit.
+This will iterate over all commit objects in the repository and may take
+a long time depending on the size of the repository.
 .It Cm Enter, Space
 Open a
 .Cm diff
@@ -210,6 +216,10 @@ Scroll up.
 Scroll down one page.
 .It Cm Page-up, Ctrl+b
 Scroll up one page.
+.It Cm Home, g, Ctrl-u
+Scroll to the top of the view.
+.It Cm End, G
+Scroll to the bottom of the view.
 .It Cm \&[
 Reduce the amount of diff context lines.
 .It Cm \&]
blob - fc51be808de240c6c11edb65c15e8270ca3fffe3
blob + f19156ff60b8708acea73670fd8fd33b02ae8c31
--- tog/tog.c
+++ tog/tog.c
@@ -2404,6 +2404,16 @@ input_log_view(struct tog_view **new_view, struct tog_
 			s->selected--;
 		else
 			log_scroll_up(s, 1);
+		select_commit(s);
+		break;
+	case 'g':
+	case CTRL('u'):
+	case KEY_HOME:
+		if (s->first_displayed_entry == NULL)
+			break;
+
+		s->selected = 0;
+		log_scroll_up(s, s->commits.ncommits);
 		select_commit(s);
 		break;
 	case KEY_PPAGE:
@@ -2429,9 +2439,28 @@ input_log_view(struct tog_view **new_view, struct tog_
 			err = log_scroll_down(view, 1);
 			if (err)
 				break;
+		}
+		select_commit(s);
+		break;
+	case 'G':
+	case KEY_END: {
+		/* We don't know yet how many commits, so we're forced to
+		 * traverse them all. */
+		while (1) {
+			if (s->thread_args.log_complete)
+				break;
+
+			s->thread_args.commits_needed++;
+			err = trigger_log_thread(view, 1);
+			if (err)
+				return err;
 		}
+
+		log_scroll_down(view, s->commits.ncommits);
+		s->selected = MIN(view->nlines - 2, s->commits.ncommits - 1);
 		select_commit(s);
 		break;
+	}
 	case KEY_NPAGE:
 	case CTRL('f'): {
 		struct commit_queue_entry *first;
@@ -3640,7 +3669,20 @@ input_diff_view(struct tog_view **new_view, struct tog
 		s->last_displayed_line = view->nlines;
 		diff_view_indicate_progress(view);
 		err = create_diff(s);
+		break;
+	case 'g':
+	case CTRL('u'):
+	case KEY_HOME:
+		s->first_displayed_line = 1;
 		break;
+	case 'G':
+	case KEY_END:
+		if (s->eof)
+			break;
+
+		s->first_displayed_line = (s->nlines - view->nlines) + 2;
+		s->eof = 1;
+		break;
 	case 'k':
 	case KEY_UP:
 		if (s->first_displayed_line > 1)