perf(ui): defer title attr resolution

In case of an overflow, the iteration will
break before the grid_line_puts call.
This commit is contained in:
Artem Krinitsyn
2026-07-20 23:40:59 +00:00
parent c6717f1f38
commit 1f045b62ba

View File

@@ -1103,12 +1103,6 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_
if (text == NULL) {
break;
}
if (attr == -1) { // No highlight specified.
attr = default_attr;
} else {
attr = hl_apply_winblend(winbl, attr);
attr = hl_combine_attr(win_hl_attr_normal, attr);
}
// Skip characters from the beginning when title overflows available width.
if (overflow > 0) {
int cells = (int)mb_string2cells(text);
@@ -1125,6 +1119,12 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_
}
text = p;
}
if (attr == -1) { // No highlight specified.
attr = default_attr;
} else {
attr = hl_apply_winblend(winbl, attr);
attr = hl_combine_attr(win_hl_attr_normal, attr);
}
col += grid_line_puts(col, text, -1, attr);
}
}