mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
fix(highlight): properly deal with underline mask when listing (#22057)
This commit is contained in:
@@ -842,14 +842,14 @@ void hlattrs2dict(Dictionary *dict, HlAttrs ae, bool use_rgb)
|
||||
PUT_C(hl, "underline", BOOLEAN_OBJ(true));
|
||||
break;
|
||||
|
||||
case HL_UNDERDOUBLE:
|
||||
PUT_C(hl, "underdouble", BOOLEAN_OBJ(true));
|
||||
break;
|
||||
|
||||
case HL_UNDERCURL:
|
||||
PUT_C(hl, "undercurl", BOOLEAN_OBJ(true));
|
||||
break;
|
||||
|
||||
case HL_UNDERDOUBLE:
|
||||
PUT_C(hl, "underdouble", BOOLEAN_OBJ(true));
|
||||
break;
|
||||
|
||||
case HL_UNDERDOTTED:
|
||||
PUT_C(hl, "underdotted", BOOLEAN_OBJ(true));
|
||||
break;
|
||||
@@ -930,8 +930,8 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
|
||||
CHECK_FLAG(dict, mask, bold, , HL_BOLD);
|
||||
CHECK_FLAG(dict, mask, italic, , HL_ITALIC);
|
||||
CHECK_FLAG(dict, mask, underline, , HL_UNDERLINE);
|
||||
CHECK_FLAG(dict, mask, underdouble, , HL_UNDERDOUBLE);
|
||||
CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL);
|
||||
CHECK_FLAG(dict, mask, underdouble, , HL_UNDERDOUBLE);
|
||||
CHECK_FLAG(dict, mask, underdotted, , HL_UNDERDOTTED);
|
||||
CHECK_FLAG(dict, mask, underdashed, , HL_UNDERDASHED);
|
||||
CHECK_FLAG(dict, mask, standout, , HL_STANDOUT);
|
||||
|
@@ -18,8 +18,8 @@ typedef enum {
|
||||
// The next three bits are all underline styles
|
||||
HL_UNDERLINE_MASK = 0x38,
|
||||
HL_UNDERLINE = 0x08,
|
||||
HL_UNDERDOUBLE = 0x10,
|
||||
HL_UNDERCURL = 0x18,
|
||||
HL_UNDERCURL = 0x10,
|
||||
HL_UNDERDOUBLE = 0x18,
|
||||
HL_UNDERDOTTED = 0x20,
|
||||
HL_UNDERDASHED = 0x28,
|
||||
// 0x30 and 0x38 spare for underline styles
|
||||
|
@@ -1553,15 +1553,20 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg
|
||||
} else { // type == LIST_ATTR
|
||||
buf[0] = NUL;
|
||||
for (int i = 0; hl_attr_table[i] != 0; i++) {
|
||||
if (iarg & hl_attr_table[i]) {
|
||||
if (((hl_attr_table[i] & HL_UNDERLINE_MASK)
|
||||
&& ((iarg & HL_UNDERLINE_MASK) == hl_attr_table[i]))
|
||||
|| (!(hl_attr_table[i] & HL_UNDERLINE_MASK)
|
||||
&& (iarg & hl_attr_table[i]))) {
|
||||
if (buf[0] != NUL) {
|
||||
xstrlcat(buf, ",", 100);
|
||||
}
|
||||
xstrlcat(buf, hl_name_table[i], 100);
|
||||
if (!(hl_attr_table[i] & HL_UNDERLINE_MASK)) {
|
||||
iarg &= ~hl_attr_table[i]; // don't want "inverse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void)syn_list_header(didh, vim_strsize((char *)ts) + (int)strlen(name) + 1, id, false);
|
||||
didh = true;
|
||||
|
@@ -214,7 +214,7 @@ describe("API: set highlight", function()
|
||||
bold = true,
|
||||
italic = true,
|
||||
reverse = true,
|
||||
underline = true,
|
||||
underdashed = true,
|
||||
strikethrough = true,
|
||||
altfont = true,
|
||||
cterm = {
|
||||
@@ -231,7 +231,7 @@ describe("API: set highlight", function()
|
||||
bold = true,
|
||||
italic = true,
|
||||
reverse = true,
|
||||
underline = true,
|
||||
underdashed = true,
|
||||
strikethrough = true,
|
||||
altfont = true,
|
||||
}
|
||||
@@ -297,7 +297,7 @@ describe("API: set highlight", function()
|
||||
exec_capture('highlight Test_hl'))
|
||||
|
||||
meths.set_hl(0, 'Test_hl2', highlight3_config)
|
||||
eq('Test_hl2 xxx cterm=italic,reverse,strikethrough,altfont,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,italic,reverse,strikethrough,altfont guifg=#ff0000 guibg=#0032aa',
|
||||
eq('Test_hl2 xxx cterm=italic,reverse,strikethrough,altfont,nocombine ctermfg=8 ctermbg=15 gui=bold,underdashed,italic,reverse,strikethrough,altfont guifg=#ff0000 guibg=#0032aa',
|
||||
exec_capture('highlight Test_hl2'))
|
||||
|
||||
-- Colors are stored with the name they are defined, but
|
||||
|
Reference in New Issue
Block a user