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

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: tog: child views don't resize properly
To:
gameoftrees@openbsd.org
Date:
Sun, 6 Dec 2020 23:44:34 +0100

Download raw body.

Thread
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.
tree needs the equivalent fix.

> --- tog/tog.c
> +++ tog/tog.c
> @@ -6131,8 +6131,8 @@ input_ref_view(struct tog_view **new_view, struct tog_
>  		err = ref_view_load_refs(s);
>  		break;
>  	case KEY_RESIZE:
> -		if (s->selected > view->nlines)
> -			s->selected = s->ndisplayed - 1;
> +		if (view->nlines >= 2 && s->selected >= view->nlines - 1)
> +			s->selected = view->nlines - 2;
>  		break;
>  	default:
>  		break;

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de