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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: tog: child views don't resize properly
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 7 Dec 2020 00:17:41 +0100

Download raw body.

Thread
On Sun, Dec 06, 2020 at 11:44:34PM +0100, Christian Weisgerber wrote:
> Stefan Sperling:
> 
> > Here is a patch for the ref view to move the selection cursor up when
> > the window shrinks. The old code is broken because s->ndisplayed is not
> > updated during a resize event.
> > 
> > Does this behave as you expect? If so, I'll try to fix others, too.
> 
> Yes, this makes ref match the behavior of log and blame.

Good :)

> tree needs the equivalent fix.

It seems that would be:

diff 8b5b8d0ca2f5e814f7cf2921c3dbe91e53012a4e /home/stsp/src/got
blob - e67c1082167be44d01ae7901b81e7374a332c86c
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -5400,8 +5400,8 @@ input_tree_view(struct tog_view **new_view, struct tog
 		}
 		break;
 	case KEY_RESIZE:
-		if (s->selected > view->nlines)
-			s->selected = s->ndisplayed - 1;
+		if (view->nlines >= 4 && s->selected >= view->nlines - 3)
+			s->selected = view->nlines - 4;
 		break;
 	default:
 		break;
 
(These diffs turn out to be smaller than I expected :)