From 18d6b2309fc2f8824854882933f11ee95d086f49 Mon Sep 17 00:00:00 2001 From: Artem Krinitsyn Date: Mon, 20 Jul 2026 19:25:24 +0000 Subject: [PATCH] fix(ui): handle combining chunked float titles Problem: The title is combined with window's attributes only if the title is a string (which implies the FloatTitle / FloatFooter highlight groups), but not when the title is text-hl chunks. Solution: Combine specified highlight group with window-local Normal highlight as well. --- src/nvim/grid.c | 3 ++- test/functional/ui/float_spec.lua | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nvim/grid.c b/src/nvim/grid.c index 97899181c1..7916ec55d7 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -1088,9 +1088,9 @@ 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_combine_attr(win_hl_attr_normal, default_attr); if (overflow > 0) { + default_attr = hl_combine_attr(win_hl_attr_normal, default_attr); grid_line_puts(1, "<", -1, hl_apply_winblend(winbl, default_attr)); col += 1; overflow += 1; @@ -1122,6 +1122,7 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_ text = p; } attr = hl_apply_winblend(winbl, attr); + attr = hl_combine_attr(win_hl_attr_normal, attr); col += grid_line_puts(col, text, -1, attr); } } diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 2b1fb1d733..49e204b6d7 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -3041,10 +3041,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 = { @@ -3057,10 +3057,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: }| | ]], }