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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: adjust line offset when resizing splits
To:
Mark Jamsek <mark@jamsek.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 11 Jul 2022 12:35:41 +0200

Download raw body.

Thread
On Mon, Jul 11, 2022 at 02:06:24AM +1000, Mark Jamsek wrote:
> Now we can resize splits, we need to adjust the line offset when
> increasing/decreasing hsplits otherwise our selection can end up
> offscreen because calls to offset_selection_up() rely on a bogus offset.
> 
> repro:
> 
> $ TOG_VIEW_SPLIT_MODE=h tog  # 80x24
> 22j
> return  # open diff view in a hsplit
> tab  # focus log (top) split
> 10+  # increase top split by 10 lines
> 22j
> return  # open diff view in a hsplit
> F  # toggle fullscreen diff view
> tab  # focus log (parent) view in fullscreen
> # selection cursor will be off the bottom of the screen
> 
> This happens because when we increase the top split (or decrease the
> bottom split), our log view line offset becomes incorrect (too large) as
> it was based on the pre-resized (smaller top split) dimensions. We need
> to adjust the offset whenever we resize a split:
>   - decrease view->offset when view->nlines increases
>   - increase view->offset when view->nlines decreases

Makes sense, and fix works as advertised.  ok stsp@