fix(highlight): add missing 'nocombine' to nvim_get_hl_* apis (#19586)

This commit is contained in:
Munif Tanjim 2022-07-31 17:38:00 +06:00 committed by GitHub
parent 380417c1dd
commit 86110ec933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -778,6 +778,10 @@ Dictionary hlattrs2dict(Dictionary *hl_alloc, HlAttrs ae, bool use_rgb)
PUT_C(hl, "strikethrough", BOOLEAN_OBJ(true));
}
if (mask & HL_NOCOMBINE) {
PUT_C(hl, "nocombine", BOOLEAN_OBJ(true));
}
if (use_rgb) {
if (mask & HL_FG_INDEXED) {
PUT_C(hl, "fg_indexed", BOOLEAN_OBJ(true));

View File

@ -34,6 +34,7 @@ describe('API: highlight',function()
underdotted = true,
underdashed = true,
strikethrough = true,
nocombine = true,
}
before_each(function()
@ -55,7 +56,7 @@ describe('API: highlight',function()
eq('Invalid highlight id: 30000', string.match(emsg, 'Invalid.*'))
-- Test all highlight properties.
command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough')
command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough,nocombine')
eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true))
-- Test nil argument.
@ -136,10 +137,10 @@ describe('API: highlight',function()
-- Test cterm & Normal values. #18024 (tail) & #18980
-- Ensure Normal, and groups that match Normal return their fg & bg cterm values
meths.set_hl(0, 'Normal', {ctermfg = 17, ctermbg = 213})
meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213})
meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213, nocombine = true})
-- Note colors are "cterm" values, not rgb-as-ints
eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'Normal', false))
eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'NotNormal', false))
eq({foreground = 17, background = 213, nocombine = true}, nvim("get_hl_by_name", 'NotNormal', false))
end)
it('nvim_get_hl_id_by_name', function()
@ -214,6 +215,7 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
strikethrough = true,
nocombine = true,
}
}
local highlight3_result_gui = {
@ -236,6 +238,7 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
strikethrough = true,
nocombine = true,
}
local function get_ns()
@ -290,7 +293,7 @@ describe("API: set highlight", function()
exec_capture('highlight Test_hl'))
meths.set_hl(0, 'Test_hl2', highlight3_config)
eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa',
eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa',
exec_capture('highlight Test_hl2'))
-- Colors are stored with the name they are defined, but