commit a75b3e2dd76c9392eb52ae19ef339a13f32eb821 from: Stefan Sperling date: Thu Jun 16 08:10:33 2022 UTC fix horizontal scrolling bug in the blame view ok op@, jamsek commit - b4996beee4ab59f339d2b4de7cfc401ba2f22c4e commit + a75b3e2dd76c9392eb52ae19ef339a13f32eb821 blob - a3599eb66772cacb41dd2c51115381919d25c083 blob + 8a28476cd4abc2585e93d816ed8368b82925038b --- tog/tog.c +++ tog/tog.c @@ -4190,7 +4190,7 @@ draw_blame(struct tog_view *view) struct tog_blame *blame = &s->blame; regmatch_t *regmatch = &view->regmatch; const struct got_error *err; - int lineno = 0, nprinted = 0; + int lineno = 0, nprinted = 0, i; char *line = NULL; size_t linesize = 0; ssize_t linelen; @@ -4332,14 +4332,18 @@ draw_blame(struct tog_view *view) } else { err = format_line(&wline, &width, line, view->x + view->ncols - 9, 9, 1); - if (!err && view->x < width - 1) { - waddwstr(view->window, wline + view->x); - width += 9; + if (err) { + free(line); + return err; + } + if (view->x < width) { + waddwstr(view->window, wline + view->x); + for (i = 0; i < view->x; i++) + width -= wcwidth(wline[i]); } + width += 9; free(wline); wline = NULL; - if (err) - return err; } if (width <= view->ncols - 1)