From: Omar Polo Subject: Re: tog: expand horizontal split support to all views To: Stefan Sperling Cc: Mark Jamsek , gameoftrees@openbsd.org Date: Sat, 02 Jul 2022 21:19:51 +0200 Stefan Sperling wrote: > On Fri, Jul 01, 2022 at 01:10:08AM +1000, Mark Jamsek wrote: > > This makes hsplits available to the remaining parent->child view > > combinations: > > > > log -> tree > > log -> ref > > tree -> log > > tree -> ref > > ref -> tree > > > > Now, hsplits are available for all the same parent->child combinations > > as vsplits. > > > > In tog, we only allow one level of child views. Views opened from child > > views become a new parent view as per this excerpt (cf. tog.c:489): > > > > * When a new view is opened from within a parent view, this new view > > * becomes a child view of the parent view, replacing any existing child. > > * > > * When a new view is opened from within a child view, this new view > > * becomes a parent view which will obscure the views below until the > > * user quits the new parent view by typing 'q'. > > > > As such, whether using v- or h-splits, if you run: > > > > $ tog > > t # tree opens in split > > return # blame opens in fullscreen > > > > However, if you then open a commit from that new blame (parent) view, it will > > open in the current split mode (i.e., h- or v-split) as a child view. > > This is OK by me, it works fine. > > There is a small cosmetic issue which I expect will not take you long > to figure out: > > Open the log view in a narrow terminal, such that some log message lines > will be truncated as they do not fit into the terminal's width. > While looking at the rightmost column of letters in the log view, hit > Enter to open a diff in a hsplit view. In the log view, the last column > of letters disappears while the hsplit diff view remains open. It's not an issue with this patch, it's been there since the hsplit was introduced. Before things were easier, draw_commit had to account for the border when there was a split, but now we have two kinds of split and need to account only when we're in a vertical split mode. diff /home/op/w/got commit - ca9235e349a714d36ca4dbdced18b97dfc8250e6 path + /home/op/w/got blob - ee96127a9d8e7c18b671e12a15b0094c34c52551 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -1752,7 +1752,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_is_hsplit_top(view) && limit > 0) limit--; /* for the border */ err = format_line(&wlogmsg, &logmsg_width, &scrollx, logmsg, view->x, limit, col, 1);