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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: fix cycle view in fullscreen regression
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 21 Jun 2022 01:43:56 +1000

Download raw body.

Thread
On 22-06-20 05:03pm, Omar Polo wrote:
> Mark Jamsek <mark@jamsek.com> wrote:
> > Actually, I think this is better. And like the other problem you
> > noticed, view_resize() now also honours fullscreen when resizing.
> 
> two bugfixes with a commit! \o/ :D
> 
> agreed, it's more self-contained and doesn't move the logic of maganing
> the child view all across all callers of view_resize.  I also like how
> this fixes the issue with the resize during fullscreen!
> 
> ok op@
> 
> there's still a small glitch, but i don't think it's introduced by your
> diff, that i found playing in ja.git.  mentioning it here in case
> someone else stumble on it.  sometimes the double-width characters in
> the log message are drawn over vborder.  to reproduce: (in a wide enough
> terminal to have a split-screen) type enter to see the diff, then F,
> then tab two times, then F again to exit the fullscreen.  We're probably
> missing a resize for the main view when exiting the fullscreen, i
> haven't tracked the issue (ENOTIME) ^^'

Good catch! Thanks, Omar.

The following diff appears to fix that too. And you were right--just
missing a resize :)

diff d8b5af438b16bcea5568b1d4bfc127567e35e2f6 refs/heads/fix/fullscreen
blob - b8935d8f4d93a4f03c1d8727adb23a6137741acf
blob + 2ff8c7a704713e901f1ef6ba088441320ce15ec2
--- tog/tog.c
+++ tog/tog.c
@@ -748,6 +748,13 @@ view_is_parent_view(struct tog_view *view)
 	return view->parent == NULL;
 }

+static int
+view_is_splitscreen(struct tog_view *view)
+{
+	return view->begin_x > 0;
+}
+
+
 static const struct got_error *
 view_resize(struct tog_view *view)
 {
@@ -763,7 +770,7 @@ view_resize(struct tog_view *view)
 	else
 		ncols = view->ncols + (COLS - view->cols);

-	if (view->child) {
+	if (view->child && view_is_splitscreen(view->child)) {
 		view->child->begin_x = view_split_begin_x(view->begin_x);
 		if (view->child->begin_x == 0) {
 			ncols = COLS;
@@ -818,12 +825,6 @@ view_set_child(struct tog_view *view, struct tog_view
 	return view_resize(view);
 }

-static int
-view_is_splitscreen(struct tog_view *view)
-{
-	return view->begin_x > 0;
-}
-
 static void
 tog_resizeterm(void)
 {
@@ -956,6 +957,8 @@ view_input(struct tog_view **new, int *done, struct to
 			view->focussed = 0;
 			view->parent->focussed = 1;
 			view->parent->focus_child = 0;
+			if (!view_is_splitscreen(view))
+				err = view_fullscreen(view->parent);
 		}
 		break;
 	case 'q':
@@ -986,6 +989,8 @@ view_input(struct tog_view **new, int *done, struct to
 				err = view_fullscreen(view);
 			} else {
 				err = view_splitscreen(view);
+				if (!err)
+					err = view_resize(view->parent);
 			}
 			if (err)
 				break;


> > diff d8b5af438b16bcea5568b1d4bfc127567e35e2f6 /Users/mark/Library/Mobile Documents/com~apple~CloudDocs/src/got-current
> > blob - b8935d8f4d93a4f03c1d8727adb23a6137741acf
> > file + tog/tog.c
> > --- tog/tog.c
> > +++ tog/tog.c
> > @@ -748,6 +748,13 @@ view_is_parent_view(struct tog_view *view)
> >  	return view->parent == NULL;
> >  }
> > 
> > +static int
> > +view_is_splitscreen(struct tog_view *view)
> > +{
> > +	return view->begin_x > 0;
> > +}
> > +
> > +
> >  static const struct got_error *
> >  view_resize(struct tog_view *view)
> >  {
> > @@ -763,7 +770,7 @@ view_resize(struct tog_view *view)
> >  	else
> >  		ncols = view->ncols + (COLS - view->cols);
> > 
> > -	if (view->child) {
> > +	if (view->child && view_is_splitscreen(view->child)) {
> >  		view->child->begin_x = view_split_begin_x(view->begin_x);
> >  		if (view->child->begin_x == 0) {
> >  			ncols = COLS;
> > @@ -818,12 +825,6 @@ view_set_child(struct tog_view *view, struct tog_view
> >  	return view_resize(view);
> >  }
> > 
> > -static int
> > -view_is_splitscreen(struct tog_view *view)
> > -{
> > -	return view->begin_x > 0;
> > -}
> > -
> >  static void
> >  tog_resizeterm(void)
> >  {
> > @@ -956,6 +957,8 @@ view_input(struct tog_view **new, int *done, struct to
> >  			view->focussed = 0;
> >  			view->parent->focussed = 1;
> >  			view->parent->focus_child = 0;
> > +			if (!view_is_splitscreen(view))
> > +				err = view_fullscreen(view->parent);
> >  		}
> >  		break;
> >  	case 'q':
> 
> 

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