Download raw body.
tog: quit after resizing fullscreen mode in horizontal split
tog: quit after resizing fullscreen mode in horizontal split
On 23-04-21 08:53PM, Mikhail wrote: > tog with 178x54 size > <enter> > S > F > resize tog to 124x37 > > the app quits for me, no core file, echo $? gives zero Thanks, Mikhail! I can reproduce this. It seems the error is being discarded here in main(): 9898 9899 if (error && error->code != GOT_ERR_CANCELLED && 9900 error->code != GOT_ERR_EOF && 9901 error->code != GOT_ERR_PRIVSEP_EXIT && 9902 error->code != GOT_ERR_PRIVSEP_PIPE && 9903 !(error->code == GOT_ERR_ERRNO && errno == EINTR)) 9904 fprintf(stderr, "%s: %s\n", getprogname(), error->msg); 9905 return 0; 9906 } The actual error is a failed wresize() call here in view_resize(): 1063 if (wresize(view->window, nlines, ncols) == ERR) 1064 return got_error_from_errno("wresize"); The call fails because nlines is negative. This is because earlier in view_resize(), when the terminal size has decreased, we define nlines by first subtracting the new (smaller) terminal height from the previous (larger) terminal height, and subracting the difference from the current view->nlines value: 1005 if (view->lines > LINES) 1006 nlines = view->nlines - (view->lines - LINES); When in horizontal split mode, the view->nlines value is the line height of the view's split, which in this case is the log view in the top split. And the difference of the decreased terminal is larger than this value. When fullscreen is not toggled, this isn't a problem because we call view_splitscreen() which recalculates the horizontal splits. However, in this case we just want the split values without splitting the screen. The below diff fixes this by resetting the nlines value for the horizontal split, like view_splitscreen() does, if the first assignment produces a negative result. While this fixes the bug, I want to refactor this a fair bit when I have more time, which should also address your "tog: no vsplit and hsplit adjustment after fullscreen toggle" mail. This won't be for a few weeks after exams and we're on session break, so I wanted to get a quick fix for this out. We could also fix this by subtracting the difference in terminal height from view->lines rather than view->nlines in the above assignment (line 1006), but that will apply to all views and I'm unsure of the fallout and lack the time to investigate. The below diff will only reset view->nlines in the problem case uncovered by Mikhail. diff /home/mark/src/got commit - 3aa652eff930e9f4d878f8d4a7d01ffd3e95e096 path + /home/mark/src/got blob - c1264e0741802f1cb6105a4bc666bda6ea965ebb file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -1050,7 +1050,9 @@ view_resize(struct tog_view *view) doupdate(); show_panel(view->child->panel); nlines = view->nlines; - } + } else if (nlines < 0 && view->mode == TOG_VIEW_SPLIT_HRZN && + view->child) + nlines = view_split_begin_y(view->lines); } else if (view->parent == NULL) ncols = COLS; -- Mark Jamsek <fnc.bsdbox.org|got.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
tog: quit after resizing fullscreen mode in horizontal split
tog: quit after resizing fullscreen mode in horizontal split