Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98e2da7

Browse files
authored
fix(hl): return cterm fg/bg even if they match Normal#18981
Fixes#18980-831fa45 is related but this doesn't regress that- The `cterm_normal_fg_color != ae.cterm_fg_color` comparison is originally carried from patch to patch starting all the way back in29bc6df where it was avoiding setting a HL attr. But `hlattrs2dict()` now is just informational.
1 parente0aa1d8 commit98e2da7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎src/nvim/highlight.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,11 @@ Dictionary hlattrs2dict(HlAttrs ae, bool use_rgb)
792792
PUT(hl,"special",INTEGER_OBJ(ae.rgb_sp_color));
793793
}
794794
}else {
795-
if (cterm_normal_fg_color!=ae.cterm_fg_color&&ae.cterm_fg_color!=0) {
795+
if (ae.cterm_fg_color!=0) {
796796
PUT(hl,"foreground",INTEGER_OBJ(ae.cterm_fg_color-1));
797797
}
798798

799-
if (cterm_normal_bg_color!=ae.cterm_bg_color&&ae.cterm_bg_color!=0) {
799+
if (ae.cterm_bg_color!=0) {
800800
PUT(hl,"background",INTEGER_OBJ(ae.cterm_bg_color-1));
801801
}
802802
}

‎test/functional/api/highlight_spec.lua‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ describe('API: highlight',function()
133133
eq({underline=true,standout=true, },
134134
meths.get_hl_by_name('cursorline',0));
135135

136+
-- Test cterm & Normal values. #18024 (tail) & #18980
137+
-- Ensure Normal, and groups that match Normal return their fg & bg cterm values
138+
meths.set_hl(0,'Normal', {ctermfg=17,ctermbg=213})
139+
meths.set_hl(0,'NotNormal', {ctermfg=17,ctermbg=213})
140+
-- Note colors are "cterm" values, not rgb-as-ints
141+
eq({foreground=17,background=213},nvim("get_hl_by_name",'Normal',false))
142+
eq({foreground=17,background=213},nvim("get_hl_by_name",'NotNormal',false))
136143
end)
137144

138145
it('nvim_get_hl_id_by_name',function()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp