mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
Merge pull request #4733 from AdnoC/hi-link-cleared-group
Fix linking a cleared highlight group Closes #4549 Closes #2756 Closes #4236
This commit is contained in:
commit
d02cfe8061
@ -6939,7 +6939,12 @@ set_hl_attr (
|
||||
// before setting attr_entry->{f,g}g_color to a other than -1
|
||||
at_en.rgb_fg_color = sgp->sg_rgb_fg_name ? sgp->sg_rgb_fg : -1;
|
||||
at_en.rgb_bg_color = sgp->sg_rgb_bg_name ? sgp->sg_rgb_bg : -1;
|
||||
sgp->sg_attr = get_attr_entry(&at_en);
|
||||
|
||||
if (at_en.cterm_fg_color != 0 || at_en.cterm_bg_color != 0
|
||||
|| at_en.rgb_fg_color != -1 || at_en.rgb_bg_color != -1
|
||||
|| at_en.cterm_ae_attr != 0 || at_en.rgb_ae_attr != 0) {
|
||||
sgp->sg_attr = get_attr_entry(&at_en);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -262,4 +262,44 @@ describe('Default highlight groups', function()
|
||||
]], {[1] = {bold = true, foreground = hlgroup_colors.Question}})
|
||||
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
||||
end)
|
||||
it('can be cleared and linked to other highlight groups', function()
|
||||
execute('highlight clear ModeMsg')
|
||||
feed('i')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
-- INSERT -- |
|
||||
]], {})
|
||||
feed('<esc>')
|
||||
execute('highlight CustomHLGroup guifg=red guibg=green')
|
||||
execute('highlight link ModeMsg CustomHLGroup')
|
||||
feed('i')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
{1:-- INSERT --} |
|
||||
]], {[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user