From: Mark Jamsek Subject: Re: tog: horizontal split To: Omar Polo Cc: gameoftrees@openbsd.org Date: Tue, 28 Jun 2022 22:11:47 +1000 On 22-06-27 09:41am, Omar Polo wrote: > Omar Polo wrote: > > [...] > > > > > > > + 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/ Thanks for digging into this, Omar :) The patch seems to break scrolling in hsplit. Could you please confirm if you can reproduce the same behaviour (i.e., this patch on top of the diff in the OP scrolls offscreen in hsplit?) repro: # 80x24 term $ tog return # open diff in hsplit # resize term to 80x30 tab # switch to log view in top split j (* 10+) # selection cursor scrolls offscreen This is what kept happening to me. I'd fix one thing only for it to break something else! > 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 :/ -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68