commit fd29e8735f8d2276b3dce90c267f67742bc5bd06 from: Omar Polo date: Sat Jan 13 22:41:46 2024 UTC don't strlcat in a loop not that of a big deal, but since we memset() at the start, just add the spaces directly instead of using strlcat. saves some cpu cycles. commit - 5ab1e3c1bda423908dde9e027f496f9d25f5e4da commit + fd29e8735f8d2276b3dce90c267f67742bc5bd06 blob - 440ceb6f9f2216d59433c6309e4acc4b13ff68f6 blob + 83bff426c3fc53cb1f21828c824714bebc25e481 --- ui.c +++ ui.c @@ -460,7 +460,8 @@ static void line_prefix_and_text(struct vline *vl, char *buf, size_t len, const char **prfx_ret, const char **text_ret, int *text_len) { - int type, i, cont, width; + int type, cont; + size_t i, width; char *space, *t; if (vl->len == 0) { @@ -485,8 +486,8 @@ line_prefix_and_text(struct vline *vl, char *buf, size if (cont) { memset(buf, 0, len); width = utf8_swidth_between(vl->parent->line, space); - for (i = 0; i < width + 1; ++i) - strlcat(buf, " ", len); + for (i = 0; i < width + 1 && i < len - 1; ++i) + buf[i] = ' '; } else { strlcpy(buf, vl->parent->line, len); if ((t = strchr(buf, ' ')) != NULL)