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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog: fix delayed tree index update
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Fri, 12 Aug 2022 23:08:14 +1000

Download raw body.

Thread
On 22-08-12 02:21PM, Stefan Sperling wrote:
> 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.

I agree. My terseness is a bad habit I've been trying to drop. I think
I've made some improvements but it's still a default--I have to be
conscious of it otherwise it creeps in. Thanks for the reminder :)

I've also been working on treating app and lib code the same; I used to
be a lot more lax in application code. Mostly because I was usually the
sole developer on such projects so I had a good idea of ownership and
what was being passed around. But I'm trying to apply the same care to
robustness as in lib code.

Anyway, this has been committed with your improvement. Thanks, Stefan!

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68