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

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: tog: horizontal split
To:
Omar Polo <op@omarpolo.com>
Cc:
Mark Jamsek <mark@jamsek.com>, gameoftrees@openbsd.org
Date:
Mon, 27 Jun 2022 09:41:15 +0200

Download raw body.

Thread
Omar Polo <op@omarpolo.com> wrote:
> [...]
>
> I was wrong, the view is resized correctly but the sizes are not taken
> into account correctly.

not really; I've found the issue (i think)
 
> oh, and yes, there is also an off by one :)
>
> [...]

> > > > +		if (hs) {
> > > > +			err = view_splitscreen(view->child);
> > > > +			if (err)
> > > > +				return err;
> > > > +			view_border(view->child);
> 
> likewise, we should call view_border on the _parent_ view, not on the
> child.
> 
> With these two tweaks the border remains when resizing the term, but
> there is still an accounting issue somewhere because parent_view->ncols
> stays at 80 even after the resize...  no idea where that happens
> 
> > > > +			update_panels();
> > > > +			doupdate();
> > > > +			show_panel(view->child->panel);
> > > > +			nlines = view->nlines;
> > > > +			ncols = view->ncols;

It's here.  We don't need to recycle the previous values for nlines and
ncols.  With the following diff on top of yours the horizontal split
seems to work correctly! \o/

diff /home/op/w/got
commit - 4302f334219f865d74e66880279c0f3a5c42c592
path + /home/op/w/got
blob - f8f7a483508a85dee159176af51fd64c508de728
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -769,7 +769,7 @@ view_splitscreen(struct tog_view *view)
 		return err;
 
 	if (view->parent && view->mode == TOG_VIEW_SPLIT_HRZN)
-		view->parent->nlines = view->lines - view->nlines - 1;
+		view->parent->nlines = view->lines - view->nlines;
 
 	if (mvwin(view->window, view->begin_y, view->begin_x) == ERR)
 		return got_error_from_errno("mvwin");
@@ -898,12 +898,10 @@ view_resize(struct tog_view *view)
 			err = view_splitscreen(view->child);
 			if (err)
 				return err;
-			view_border(view->child);
+			view_border(view);
 			update_panels();
 			doupdate();
 			show_panel(view->child->panel);
-			nlines = view->nlines;
-			ncols = view->ncols;
 		}
 	} else if (view->parent == NULL)
 		ncols = COLS;


to be fair, there is introduces a small error in the accounting in
draw_commit, but no big deal

diff /home/op/w/got
commit - 5978b849eebafa008927a4068bcd94abe425d8e4
path + /home/op/w/got
blob - d9108dfead5e504e29384d3ac75b8aacc4f8609c
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -1724,7 +1724,7 @@ draw_commit(struct tog_view *view, struct got_commit_o
 	if (newline)
 		*newline = '\0';
 	limit = avail - col;
-	if (view->child && view_is_splitscreen(view->child) && limit > 0)
+	if (view->child && view->mode == TOG_VIEW_SPLIT_VERT && limit > 0)
 		limit--;	/* for the border */
 	err = format_line(&wlogmsg, &logmsg_width, &scrollx, logmsg, view->x,
 	    limit, col, 1);

ja.git is still broken for me thought :/