mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
Merge pull request #21041 from neovim/backport-21033-to-release-0.8
[Backport release-0.8] fix(ui): fix some cases of stale highlight definitions
This commit is contained in:
commit
32b0b13cc5
@ -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)
|
||||
{
|
||||
assert(ns_id > 0);
|
||||
|
@ -2071,6 +2071,8 @@ void highlight_changed(void)
|
||||
}
|
||||
}
|
||||
highlight_ga.ga_len = hlcnt;
|
||||
|
||||
decor_provider_invalidate_hl();
|
||||
}
|
||||
|
||||
/// Handle command line completion for :highlight command.
|
||||
|
@ -1745,38 +1745,40 @@ describe("'winhighlight' highlight", function()
|
||||
clear()
|
||||
screen = Screen.new(20,8)
|
||||
screen:attach()
|
||||
screen:set_default_attr_ids({
|
||||
[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[1] = {background = Screen.colors.DarkBlue},
|
||||
[2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1},
|
||||
[3] = {bold = true, reverse = true},
|
||||
[4] = {reverse = true},
|
||||
[5] = {background = Screen.colors.DarkGreen},
|
||||
[6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1},
|
||||
[7] = {background = Screen.colors.DarkMagenta},
|
||||
[8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1},
|
||||
[9] = {foreground = Screen.colors.Brown},
|
||||
[10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue},
|
||||
[11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true},
|
||||
[12] = {background = Screen.colors.DarkGreen, reverse = true},
|
||||
[13] = {background = Screen.colors.Magenta4, reverse = true},
|
||||
[14] = {background = Screen.colors.DarkBlue, reverse = true},
|
||||
[15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||
[16] = {foreground = Screen.colors.Blue1},
|
||||
[17] = {background = Screen.colors.LightRed},
|
||||
[18] = {background = Screen.colors.Gray90},
|
||||
[19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray},
|
||||
[20] = {background = Screen.colors.LightGrey, underline = true},
|
||||
[21] = {bold = true},
|
||||
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||
[23] = {background = Screen.colors.LightMagenta},
|
||||
[24] = {background = Screen.colors.WebGray},
|
||||
[25] = {bold = true, foreground = Screen.colors.Green1},
|
||||
[26] = {background = Screen.colors.Red},
|
||||
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
|
||||
[28] = {bold = true, foreground = Screen.colors.Brown},
|
||||
screen:set_default_attr_ids {
|
||||
[0] = {bold=true, foreground=Screen.colors.Blue};
|
||||
[1] = {background = Screen.colors.DarkBlue};
|
||||
[2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1};
|
||||
[3] = {bold = true, reverse = true};
|
||||
[4] = {reverse = true};
|
||||
[5] = {background = Screen.colors.DarkGreen};
|
||||
[6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1};
|
||||
[7] = {background = Screen.colors.DarkMagenta};
|
||||
[8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1};
|
||||
[9] = {foreground = Screen.colors.Brown};
|
||||
[10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue};
|
||||
[11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true};
|
||||
[12] = {background = Screen.colors.DarkGreen, reverse = true};
|
||||
[13] = {background = Screen.colors.Magenta4, reverse = true};
|
||||
[14] = {background = Screen.colors.DarkBlue, reverse = true};
|
||||
[15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
|
||||
[16] = {foreground = Screen.colors.Blue1};
|
||||
[17] = {background = Screen.colors.LightRed};
|
||||
[18] = {background = Screen.colors.Gray90};
|
||||
[19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray};
|
||||
[20] = {background = Screen.colors.LightGrey, underline = true};
|
||||
[21] = {bold = true};
|
||||
[22] = {bold = true, foreground = Screen.colors.SeaGreen4};
|
||||
[23] = {background = Screen.colors.LightMagenta};
|
||||
[24] = {background = Screen.colors.WebGray};
|
||||
[25] = {bold = true, foreground = Screen.colors.Green1};
|
||||
[26] = {background = Screen.colors.Red};
|
||||
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1};
|
||||
[28] = {bold = true, foreground = Screen.colors.Brown};
|
||||
[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 Background2 guibg=DarkGreen")
|
||||
end)
|
||||
@ -2021,6 +2023,33 @@ describe("'winhighlight' highlight", function()
|
||||
]])
|
||||
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()
|
||||
command('set sidescroll=0')
|
||||
insert('Lorem ipsum dolor sit amet ')
|
||||
|
Loading…
Reference in New Issue
Block a user