fix(highlight): apply 'winblend' to float border (#25981)

This commit is contained in:
zeertzjq 2023-11-11 15:12:58 +08:00 committed by GitHub
parent fdaf6bc557
commit 6c3e170e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 9 deletions

View File

@ -374,10 +374,15 @@ void update_window_hl(win_T *wp, bool invalid)
if (wp->w_float_config.border_hl_ids[i]) {
attr = hl_get_ui_attr(ns_id, HLF_BORDER,
wp->w_float_config.border_hl_ids[i], false);
HlAttrs a = syn_attr2entry(attr);
if (a.hl_blend) {
wp->w_float_config.shadow = true;
}
}
HlAttrs a = syn_attr2entry(attr);
if (a.hl_blend == -1 && wp->w_p_winbl > 0) {
HlEntry entry = attr_entry(attr);
a.hl_blend = entry.attr.hl_blend = (int)wp->w_p_winbl;
attr = get_attr_entry(entry);
}
if (a.hl_blend > 0) {
wp->w_float_config.shadow = true;
}
wp->w_float_config.border_attr[i] = attr;
}

View File

@ -2686,7 +2686,7 @@ static const char *did_set_winblend(optset_T *args)
if (value != old_value) {
win->w_p_winbl = MAX(MIN(win->w_p_winbl, 100), 0);
win->w_hl_needs_update = true;
check_blending(curwin);
check_blending(win);
}
return NULL;

View File

@ -1017,7 +1017,7 @@ describe('float window', function()
{1: }|
{2:~ }|
]], float_pos={
[5] = {{id = 1002}, "NW", 4, 2, 10, true, 50};
[5] = {{id = 1002}, "NW", 4, 2, 10, true};
}}
else
screen:expect([[
@ -9191,6 +9191,13 @@ describe('float window', function()
[13] = {background = Screen.colors.LightGray, blend = 30},
[14] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey88},
[15] = {foreground = tonumber('0x939393'), background = Screen.colors.Grey88},
[16] = {background = Screen.colors.Grey90};
[17] = {blend = 100};
[18] = {background = Screen.colors.LightMagenta, blend = 100};
[19] = {background = Screen.colors.LightMagenta, bold = true, blend = 100, foreground = Screen.colors.Blue1};
[20] = {background = Screen.colors.White, foreground = Screen.colors.Gray0};
[21] = {background = Screen.colors.White, bold = true, foreground = tonumber('0x00007f')};
[22] = {background = Screen.colors.Gray90, foreground = Screen.colors.Gray0};
})
insert([[
Lorem ipsum dolor sit amet, consectetur
@ -9321,9 +9328,7 @@ describe('float window', function()
{13:test }|
{13: }|
{13:popup text }|
]], float_pos={
[4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
}}
]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
@ -9477,6 +9482,56 @@ describe('float window', function()
|
]])
end
-- Check that 'winblend' applies to border
meths.win_set_config(win, {border='single'})
meths.set_option_value('winblend', 100, {win=win.id})
meths.set_option_value("cursorline", true, {win=0})
command('hi clear VertSplit')
feed('k0')
if multigrid then
screen:expect{grid=[[
## grid 1
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[2:--------------------------------------------------]|
[3:--------------------------------------------------]|
## grid 2
Ut enim ad minim veniam, quis nostrud |
exercitation ullamco laboris nisi ut aliquip ex |
ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum |
dolore eu fugiat nulla pariatur. Excepteur sint |
occaecat cupidatat non proident, sunt in culpa |
{16:^qui officia deserunt mollit anim id est }|
laborum. |
## grid 3
|
## grid 4
{17:}|
{17:}{11:popup text}{18: }{17:}|
{17:}{19:~ }{17:}|
{17:}{19:~ }{17:}|
{17:}|
]], float_pos={[4] = {{id = 1001}, "NW", 1, 2, 5, true}}}
else
screen:expect([[
Ut enim ad minim veniam, quis nostrud |
exercitation ullamco laboris nisi ut aliquip ex |
ea co{20:}Duis aute irure dolor in |
repre{20:}{5:popup}{6:it i}{5:text}{20:lu}tate velit esse cillum |
dolor{20:}{21:~}{20:eu fugiat null} pariatur. Excepteur sint |
occae{20:}{21:~}{20:t cupidatat no} proident, sunt in culpa |
{16:^qui o}{22:}{16:ollit anim id est }|
laborum. |
|
]])
end
end)
it('can overlap doublewidth chars', function()