Skip to content

Commit cfc71f1

Browse files
MunifTanjimsmjonas
authored andcommitted
fix(highlight): add missing 'nocombine' to nvim_get_hl_* apis (neovim#19586)
1 parent 51d7c2a commit cfc71f1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/nvim/highlight.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,10 @@ Dictionary hlattrs2dict(Dictionary *hl_alloc, HlAttrs ae, bool use_rgb)
778778
PUT_C(hl, "strikethrough", BOOLEAN_OBJ(true));
779779
}
780780

781+
if (mask & HL_NOCOMBINE) {
782+
PUT_C(hl, "nocombine", BOOLEAN_OBJ(true));
783+
}
784+
781785
if (use_rgb) {
782786
if (mask & HL_FG_INDEXED) {
783787
PUT_C(hl, "fg_indexed", BOOLEAN_OBJ(true));

test/functional/api/highlight_spec.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('API: highlight',function()
3434
underdotted = true,
3535
underdashed = true,
3636
strikethrough = true,
37+
nocombine = true,
3738
}
3839

3940
before_each(function()
@@ -55,7 +56,7 @@ describe('API: highlight',function()
5556
eq('Invalid highlight id: 30000', string.match(emsg, 'Invalid.*'))
5657

5758
-- Test all highlight properties.
58-
command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough')
59+
command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough,nocombine')
5960
eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true))
6061

6162
-- Test nil argument.
@@ -136,10 +137,10 @@ describe('API: highlight',function()
136137
-- Test cterm & Normal values. #18024 (tail) & #18980
137138
-- Ensure Normal, and groups that match Normal return their fg & bg cterm values
138139
meths.set_hl(0, 'Normal', {ctermfg = 17, ctermbg = 213})
139-
meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213})
140+
meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213, nocombine = true})
140141
-- Note colors are "cterm" values, not rgb-as-ints
141142
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))
143+
eq({foreground = 17, background = 213, nocombine = true}, nvim("get_hl_by_name", 'NotNormal', false))
143144
end)
144145

145146
it('nvim_get_hl_id_by_name', function()
@@ -214,6 +215,7 @@ describe("API: set highlight", function()
214215
reverse = true,
215216
undercurl = true,
216217
strikethrough = true,
218+
nocombine = true,
217219
}
218220
}
219221
local highlight3_result_gui = {
@@ -236,6 +238,7 @@ describe("API: set highlight", function()
236238
reverse = true,
237239
undercurl = true,
238240
strikethrough = true,
241+
nocombine = true,
239242
}
240243

241244
local function get_ns()
@@ -290,7 +293,7 @@ describe("API: set highlight", function()
290293
exec_capture('highlight Test_hl'))
291294

292295
meths.set_hl(0, 'Test_hl2', highlight3_config)
293-
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',
296+
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',
294297
exec_capture('highlight Test_hl2'))
295298

296299
-- Colors are stored with the name they are defined, but

0 commit comments

Comments
 (0)