commit 77fc0a255189c6c18e1ea0d6ea82ae1d0ddb4ea7 from: Stefan Sperling date: Fri May 26 13:32:09 2023 UTC fix 'tog log' display regression with long reference lists When the terminal becomes smaller horizontally we did not properly account for remaining columns and the log message of a commit could overflow into the next line, garbling the display. commit - f2e547bc13d05b5421166896fb342d178fa7dc1f commit + 77fc0a255189c6c18e1ea0d6ea82ae1d0ddb4ea7 blob - b36e61c3235f83e985356cd25d8fb8657cc2f6c8 blob + 96f7de49f09ae8cf589aa33bf8856131995de5fb --- tog/tog.c +++ tog/tog.c @@ -2505,7 +2505,7 @@ draw_commit(struct tog_view *view, struct got_commit_o if (refs_str) { char *newlogmsg; wchar_t *ws; - + /* * The length of this wide-char sub-string will be * needed later for colorization. @@ -2540,11 +2540,12 @@ draw_commit(struct tog_view *view, struct got_commit_o wattr_on(view->window, COLOR_PAIR(tc->colorpair), NULL); waddnwstr(view->window, &wlogmsg[scrollx], - wrefstr_len - scrollx); + MIN(logmsg_width, wrefstr_len - scrollx)); if (tc) wattr_off(view->window, COLOR_PAIR(tc->colorpair), NULL); - waddwstr(view->window, &wlogmsg[wrefstr_len]); + if (col + MIN(logmsg_width, wrefstr_len - scrollx) < avail) + waddwstr(view->window, &wlogmsg[wrefstr_len]); } else waddwstr(view->window, &wlogmsg[scrollx]); col += MAX(logmsg_width, 0);