Merge pull request #17377 from clason/keyset-more

feat(highlight): add strikethrough, nocombine to `nvim_set_hl`
This commit is contained in:
bfredl 2022-02-12 14:05:12 +01:00 committed by GitHub
commit a1f34b2481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -81,10 +81,12 @@ return {
highlight = {
"bold";
"standout";
"strikethrough";
"underline";
"undercurl";
"italic";
"reverse";
"nocombine";
"default";
"global";
"cterm";
@ -100,10 +102,12 @@ return {
highlight_cterm = {
"bold";
"standout";
"strikethrough";
"underline";
"undercurl";
"italic";
"reverse";
"nocombine";
};
}

View File

@ -815,6 +815,8 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL);
CHECK_FLAG(dict, mask, italic, , HL_ITALIC);
CHECK_FLAG(dict, mask, reverse, , HL_INVERSE);
CHECK_FLAG(dict, mask, strikethrough, , HL_STRIKETHROUGH);
CHECK_FLAG(dict, mask, nocombine, , HL_NOCOMBINE);
CHECK_FLAG(dict, mask, default, _, HL_DEFAULT);
CHECK_FLAG(dict, mask, global, , HL_GLOBAL);
@ -871,6 +873,8 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
CHECK_FLAG(cterm, cterm_mask, undercurl, , HL_UNDERCURL);
CHECK_FLAG(cterm, cterm_mask, italic, , HL_ITALIC);
CHECK_FLAG(cterm, cterm_mask, reverse, , HL_INVERSE);
CHECK_FLAG(cterm, cterm_mask, strikethrough, , HL_STRIKETHROUGH);
CHECK_FLAG(cterm, cterm_mask, nocombine, , HL_NOCOMBINE);
} else if (HAS_KEY(dict->cterm)) {
api_set_error(err, kErrorTypeValidation, "'cterm' must be a Dictionary.");

View File

@ -195,10 +195,12 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
underline = true,
strikethrough = true,
cterm = {
italic = true,
reverse = true,
undercurl = true,
strikethrough = true,
}
}
local highlight3_result_gui = {
@ -209,6 +211,7 @@ describe("API: set highlight", function()
reverse = true,
undercurl = true,
underline = true,
strikethrough = true,
}
local highlight3_result_cterm = {
background = highlight_color.ctermbg,
@ -216,6 +219,7 @@ describe("API: set highlight", function()
italic = true,
reverse = true,
undercurl = true,
strikethrough = true,
}
local function get_ns()
@ -264,7 +268,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 ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,italic,reverse guifg=#ff0000 guibg=#0032aa',
eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa',
exec_capture('highlight Test_hl2'))
-- Colors are stored exactly as they are defined.