mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #21033 from bfredl/winfix
fix(ui): fix some cases of stale highlight definitions
This commit is contained in:
commit
0a96f18ed7
@ -194,6 +194,25 @@ void decor_providers_invoke_end(DecorProviders *providers, char **err)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mark all cached state of per-namespace highlights as invalid. Revalidate
|
||||||
|
/// current namespace.
|
||||||
|
///
|
||||||
|
/// Expensive! Should on be called by an already throttled validity check
|
||||||
|
/// like highlight_changed() (throttled to the next redraw or mode change)
|
||||||
|
void decor_provider_invalidate_hl(void)
|
||||||
|
{
|
||||||
|
size_t len = kv_size(decor_providers);
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
DecorProvider *item = &kv_A(decor_providers, i);
|
||||||
|
item->hl_cached = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ns_hl_active) {
|
||||||
|
ns_hl_active = -1;
|
||||||
|
hl_check_ns();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DecorProvider *get_decor_provider(NS ns_id, bool force)
|
DecorProvider *get_decor_provider(NS ns_id, bool force)
|
||||||
{
|
{
|
||||||
assert(ns_id > 0);
|
assert(ns_id > 0);
|
||||||
|
@ -2073,6 +2073,8 @@ void highlight_changed(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
highlight_ga.ga_len = hlcnt;
|
highlight_ga.ga_len = hlcnt;
|
||||||
|
|
||||||
|
decor_provider_invalidate_hl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle command line completion for :highlight command.
|
/// Handle command line completion for :highlight command.
|
||||||
|
@ -1743,38 +1743,40 @@ describe("'winhighlight' highlight", function()
|
|||||||
clear()
|
clear()
|
||||||
screen = Screen.new(20,8)
|
screen = Screen.new(20,8)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids {
|
||||||
[0] = {bold=true, foreground=Screen.colors.Blue},
|
[0] = {bold=true, foreground=Screen.colors.Blue};
|
||||||
[1] = {background = Screen.colors.DarkBlue},
|
[1] = {background = Screen.colors.DarkBlue};
|
||||||
[2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1},
|
[2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1};
|
||||||
[3] = {bold = true, reverse = true},
|
[3] = {bold = true, reverse = true};
|
||||||
[4] = {reverse = true},
|
[4] = {reverse = true};
|
||||||
[5] = {background = Screen.colors.DarkGreen},
|
[5] = {background = Screen.colors.DarkGreen};
|
||||||
[6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1},
|
[6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1};
|
||||||
[7] = {background = Screen.colors.DarkMagenta},
|
[7] = {background = Screen.colors.DarkMagenta};
|
||||||
[8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1},
|
[8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1};
|
||||||
[9] = {foreground = Screen.colors.Brown},
|
[9] = {foreground = Screen.colors.Brown};
|
||||||
[10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue},
|
[10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue};
|
||||||
[11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true},
|
[11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true};
|
||||||
[12] = {background = Screen.colors.DarkGreen, reverse = true},
|
[12] = {background = Screen.colors.DarkGreen, reverse = true};
|
||||||
[13] = {background = Screen.colors.Magenta4, reverse = true},
|
[13] = {background = Screen.colors.Magenta4, reverse = true};
|
||||||
[14] = {background = Screen.colors.DarkBlue, reverse = true},
|
[14] = {background = Screen.colors.DarkBlue, reverse = true};
|
||||||
[15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
[15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
|
||||||
[16] = {foreground = Screen.colors.Blue1},
|
[16] = {foreground = Screen.colors.Blue1};
|
||||||
[17] = {background = Screen.colors.LightRed},
|
[17] = {background = Screen.colors.LightRed};
|
||||||
[18] = {background = Screen.colors.Gray90},
|
[18] = {background = Screen.colors.Gray90};
|
||||||
[19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray},
|
[19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray};
|
||||||
[20] = {background = Screen.colors.LightGrey, underline = true},
|
[20] = {background = Screen.colors.LightGrey, underline = true};
|
||||||
[21] = {bold = true},
|
[21] = {bold = true};
|
||||||
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[22] = {bold = true, foreground = Screen.colors.SeaGreen4};
|
||||||
[23] = {background = Screen.colors.LightMagenta},
|
[23] = {background = Screen.colors.LightMagenta};
|
||||||
[24] = {background = Screen.colors.WebGray},
|
[24] = {background = Screen.colors.WebGray};
|
||||||
[25] = {bold = true, foreground = Screen.colors.Green1},
|
[25] = {bold = true, foreground = Screen.colors.Green1};
|
||||||
[26] = {background = Screen.colors.Red},
|
[26] = {background = Screen.colors.Red};
|
||||||
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
|
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1};
|
||||||
[28] = {bold = true, foreground = Screen.colors.Brown},
|
[28] = {bold = true, foreground = Screen.colors.Brown};
|
||||||
[29] = {foreground = Screen.colors.Blue1, background = Screen.colors.Red, bold = true};
|
[29] = {foreground = Screen.colors.Blue1, background = Screen.colors.Red, bold = true};
|
||||||
})
|
[30] = {background = tonumber('0xff8800')};
|
||||||
|
[31] = {background = tonumber('0xff8800'), bold = true, foreground = Screen.colors.Blue};
|
||||||
|
}
|
||||||
command("hi Background1 guibg=DarkBlue")
|
command("hi Background1 guibg=DarkBlue")
|
||||||
command("hi Background2 guibg=DarkGreen")
|
command("hi Background2 guibg=DarkGreen")
|
||||||
end)
|
end)
|
||||||
@ -2019,6 +2021,33 @@ describe("'winhighlight' highlight", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('updates background to changed linked group', function()
|
||||||
|
command("split")
|
||||||
|
command("setlocal winhl=Normal:FancyGroup") -- does not yet exist
|
||||||
|
screen:expect{grid=[[
|
||||||
|
^ |
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{3:[No Name] }|
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{4:[No Name] }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
command("hi FancyGroup guibg=#FF8800") -- nice orange
|
||||||
|
screen:expect{grid=[[
|
||||||
|
{30:^ }|
|
||||||
|
{31:~ }|
|
||||||
|
{31:~ }|
|
||||||
|
{3:[No Name] }|
|
||||||
|
|
|
||||||
|
{0:~ }|
|
||||||
|
{4:[No Name] }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
end)
|
||||||
|
|
||||||
it('background applies also to non-text', function()
|
it('background applies also to non-text', function()
|
||||||
command('set sidescroll=0')
|
command('set sidescroll=0')
|
||||||
insert('Lorem ipsum dolor sit amet ')
|
insert('Lorem ipsum dolor sit amet ')
|
||||||
|
Loading…
Reference in New Issue
Block a user