Download raw body.
tog: handle Home/End for log and diff views
Jasper Lievisse Adriaanse:
> Here's a diff that allows one to quickly navigate to the first or last
> item of a particular view. Currently I've implemented it for the diff and
> log views as these are the ones I use most often.
> diff --git a/tog/tog.1 b/tog/tog.1
Heresy!!
> --- a/tog/tog.c
> +++ b/tog/tog.c
> @@ -2406,6 +2406,14 @@ input_log_view(struct tog_view **new_view, struct tog_view *view, int ch)
> log_scroll_up(s, 1);
> select_commit(s);
> break;
> + 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:
> case CTRL('b'):
> if (s->first_displayed_entry == NULL)
We can directly go to the head of the list, we don't need to traverse
it backwards.
diff refs/heads/main refs/heads/tweak
blob - 676aa5bfd38d46389ada9f6d333fc7b1eab64913
blob + 026ea0f67b5944ff6c2f0bdd37d49b8d84fcca4c
--- tog/tog.c
+++ tog/tog.c
@@ -2420,11 +2420,8 @@ input_log_view(struct tog_view **new_view, struct tog_
break;
case 'g':
case KEY_HOME:
- if (s->first_displayed_entry == NULL)
- break;
-
s->selected = 0;
- log_scroll_up(s, s->commits.ncommits);
+ s->first_displayed_entry = TAILQ_FIRST(&s->commits.head);
select_commit(s);
break;
case KEY_PPAGE:
--
Christian "naddy" Weisgerber naddy@mips.inka.de
tog: handle Home/End for log and diff views