diff options
author | Oliver Marriott <rktjmp@users.noreply.github.com> | 2022-06-04 01:29:49 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 08:29:49 -0700 |
commit | 9aba2043351c79cd9bc8fa7b229ee7629ba178f0 (patch) | |
tree | a9fcc74f7e0c2f3634899978c22915742dc813b2 | |
parent | 84d8cc3ae51a0b98c9c2a82e148e90ee27798961 (diff) | |
download | rneovim-9aba2043351c79cd9bc8fa7b229ee7629ba178f0.tar.gz rneovim-9aba2043351c79cd9bc8fa7b229ee7629ba178f0.tar.bz2 rneovim-9aba2043351c79cd9bc8fa7b229ee7629ba178f0.zip |
fix(hl): set Normal hl group sg_attr value #18820
fix #18024
-rw-r--r-- | src/nvim/highlight_group.c | 4 | ||||
-rw-r--r-- | test/functional/api/highlight_spec.lua | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 05781dd7e2..9d61141e98 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -738,6 +738,8 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) g->sg_script_ctx = current_sctx; g->sg_script_ctx.sc_lnum += sourcing_lnum; + g->sg_attr = hl_get_syn_attr(0, id, attrs); + // 'Normal' is special if (STRCMP(g->sg_name_u, "NORMAL") == 0) { cterm_normal_fg_color = g->sg_cterm_fg; @@ -747,8 +749,6 @@ void set_hl_group(int id, HlAttrs attrs, Dict(highlight) *dict, int link_id) normal_sp = g->sg_rgb_sp; ui_default_colors_set(); } else { - g->sg_attr = hl_get_syn_attr(0, id, attrs); - // a cursor style uses this syn_id, make sure its attribute is updated. if (cursor_mode_uses_syn_id(id)) { ui_mode_info_set(); diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index a2f8353868..785f72b3db 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -337,4 +337,10 @@ describe("API: set highlight", function() exec_capture('highlight Test_hl3')) end) + + it ("correctly sets 'Normal' internal properties", function() + -- Normal has some special handling internally. #18024 + meths.set_hl(0, 'Normal', {fg='#000083', bg='#0000F3'}) + eq({foreground = 131, background = 243}, nvim("get_hl_by_name", 'Normal', true)) + end) end) |