Download raw body.
tog: handle Home/End for log and diff views
On Mon, Aug 30, 2021 at 07:36:15PM +0200, Stefan Sperling wrote:
> On Mon, Aug 30, 2021 at 02:19:10PM +0200, Jasper Lievisse Adriaanse wrote:
> > On Mon, Aug 30, 2021 at 12:53:29PM +0200, Stefan Sperling wrote:
> > > As we discussed over lunch, there should be a way for users to abort
> > > loading in case they hit the key by accident. Backspace is already
> > > bound for this purpose while searching. Perhaps we can generalize
> > > Backspace to abort loading in general? In any case, if we want to
> > > support cancellation it could be added in a follow-up patch.
> >
> > Generalizing that would be preferable so we don't add individual hacks
> > for all future additions. Also we could make it so that any operation
> > involving the logger thread could be canceled.
>
> This is a patch I came up with in order to solve the immediate usability
> issue. It allows for cancellation with backspace in case the user triggers
> the load operation by accident.
>
> If you think it could be generalized further such changes could be
> committed on top of this diff.
>
> ok?
Yeah, this is the better approach I think. Two small nits though.
> @@ -2446,16 +2454,11 @@ input_log_view(struct tog_view **new_view, struct tog_
> 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;
> + if (!s->thread_args.log_complete) {
> + s->thread_args.load_all = 1;
> + return trigger_log_thread(view, 0);
> }
> -
> +
Looks like an extra tab snuck in here.
The manpage could use a small tweak along these lines:
--- a/tog/tog.1
+++ b/tog/tog.1
@@ -123,10 +123,11 @@ Open a
.Cm tree
view showing the tree for the currently selected commit.
.It Cm Backspace
-Show log entries for the parent directory of the currently selected path,
-unless an active search is in progress in which case
+Show log entries for the parent directory of the currently selected path.
+However when an active search is in progress or when additional commits
+are loaded,
.Cm Backspace
-aborts the search.
+aborts the running operation.
.It Cm /
Prompt for a search pattern and start searching for matching commits.
The search pattern is an extended regular expression which is matched
--
jasper
tog: handle Home/End for log and diff views