Merge #40873 fix(ui): handle combining chunked float titles

This commit is contained in:
Justin M. Keyes
2026-07-21 11:45:44 -04:00
committed by GitHub
2 changed files with 12 additions and 9 deletions

View File

@@ -1088,10 +1088,11 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_
int win_hl_attr_normal, BorderTextType bt, int overflow)
{
int default_attr = hl_attr[bt == kBorderTextTitle ? HLF_BTITLE : HLF_BFOOTER];
default_attr = hl_apply_winblend(winbl, default_attr);
default_attr = hl_combine_attr(win_hl_attr_normal, default_attr);
if (overflow > 0) {
grid_line_puts(1, "<", -1, hl_apply_winblend(winbl, default_attr));
grid_line_puts(1, "<", -1, default_attr);
col += 1;
overflow += 1;
}
@@ -1102,9 +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;
}
// Skip characters from the beginning when title overflows available width.
if (overflow > 0) {
int cells = (int)mb_string2cells(text);
@@ -1121,7 +1119,12 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_
}
text = p;
}
attr = hl_apply_winblend(winbl, attr);
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);
}
}

View File

@@ -3042,10 +3042,10 @@ describe('float window', function()
## grid 3
|
## grid 4
{33:╔}🦄{7:BB}{33:═════╗}|
{33:╔}{1:🦄}{7:BB}{33:═════╗}|
{33:║}{1: halloj! }{33:║}|
{33:║}{1: BORDAA }{33:║}|
{33:╚}🦄{7:BB}{33:═════╝}|
{33:╚}{1:🦄}{7:BB}{33:═════╝}|
]],
float_pos = { [4] = { 1001, 'NW', 1, 2, 5, true, 50, 1, 2, 5 } },
win_viewport = {
@@ -3058,10 +3058,10 @@ describe('float window', function()
grid = [[
^ |
{0:~ }|
{0:~ }{33:╔}🦄{7:BB}{33:═════╗}{0: }|
{0:~ }{33:╔}{1:🦄}{7:BB}{33:═════╗}{0: }|
{0:~ }{33:║}{1: halloj! }{33:║}{0: }|
{0:~ }{33:║}{1: BORDAA }{33:║}{0: }|
{0:~ }{33:╚}🦄{7:BB}{33:═════╝}{0: }|
{0:~ }{33:╚}{1:🦄}{7:BB}{33:═════╝}{0: }|
|
]],
}