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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: fix delayed tree index update
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Fri, 12 Aug 2022 14:21:52 +0200

Download raw body.

Thread
On Fri, Aug 12, 2022 at 09:49:31PM +1000, Mark Jamsek wrote:
> Nice simple fix :)
> 
> Use the first displayed entry and line index to update the tree index so
> we don't have a delay after halfdelay has been set via the blame view.
> 
> repro:
>   $ tog tree
>   return  # open blame view
>   tab  # cycle back to tree view
>   10g
>   *it takes 1 second for the index to change from 1/19 to 10/19*
> 
> ok?

ok by me, though for clarity I would phrase this:

> +		i += s->tree != s->root;  /* account for ".." entry */

as follows:
		if (s->tree != s->root)
			i++;

Your code is not incorrect, but I would rather avoid clever C tricks
like this. They can make the code harder to read for people who
are still learning C.