Skip to content

Commit 38d7114

Browse files
zeertzjqsmjonas
authored andcommitted
refactor(highlight)!: rename attributes to match Vim (neovim#19159)
Ref: vim/vim@84f5463 Rename: - `underlineline` to `underdouble` - `underdot` to `underdotted` - `underdash` to `underdashed` `underdouble` also now takes higher precedence than `undercurl`.
1 parent 072f7fb commit 38d7114

File tree

17 files changed

+115
-106
lines changed

17 files changed

+115
-106
lines changed

runtime/doc/api.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,10 +1477,10 @@ nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
14771477
• bold: boolean
14781478
• standout: boolean
14791479
• underline: boolean
1480-
• underlineline: boolean
14811480
• undercurl: boolean
1482-
• underdot: boolean
1483-
• underdash: boolean
1481+
• underdouble: boolean
1482+
• underdotted: boolean
1483+
• underdashed: boolean
14841484
• strikethrough: boolean
14851485
• italic: boolean
14861486
• reverse: boolean

runtime/doc/builtin.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8026,10 +8026,10 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
80268026
"inverse" "1" if inverse (= reverse)
80278027
"standout" "1" if standout
80288028
"underline" "1" if underlined
8029-
"underlineline" "1" if double underlined
80308029
"undercurl" "1" if undercurled
8031-
"underdot" "1" if dotted underlined
8032-
"underdash" "1" if dashed underlined
8030+
"underdouble" "1" if double underlined
8031+
"underdotted" "1" if dotted underlined
8032+
"underdashed" "1" if dashed underlined
80338033
"strikethrough" "1" if struckthrough
80348034

80358035
Example (echoes the color of the syntax item under the

runtime/doc/syntax.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4895,19 +4895,19 @@ the same syntax file on all UIs.
48954895

48964896
1. TUI highlight arguments
48974897

4898-
*bold* *underline* *underlineline*
4899-
*undercurl* *underdot* *underdash*
4900-
*inverse* *italic* *standout*
4901-
*nocombine* *strikethrough*
4898+
*bold* *underline* *undercurl*
4899+
*underdouble* *underdotted*
4900+
*underdashed* *inverse* *italic*
4901+
*standout* *nocombine* *strikethrough*
49024902
cterm={attr-list} *attr-list* *highlight-cterm* *E418*
49034903
attr-list is a comma-separated list (without spaces) of the
49044904
following items (in any order):
49054905
bold
49064906
underline
4907-
underlineline double underline
49084907
undercurl curly underline
4909-
underdot dotted underline
4910-
underdash dashed underline
4908+
underdouble double underline
4909+
underdotted dotted underline
4910+
underdashed dashed underline
49114911
strikethrough
49124912
reverse
49134913
inverse same as reverse
@@ -4918,7 +4918,7 @@ cterm={attr-list} *attr-list* *highlight-cterm* *E418*
49184918

49194919
Note that "bold" can be used here and by using a bold font. They
49204920
have the same effect.
4921-
"underlineline", "undercurl", "underdot", and "underdash" fall back
4921+
"undercurl", "underdouble", "underdotted", and "underdashed" fall back
49224922
to "underline" in a terminal that does not support them. The color is
49234923
set using |highlight-guisp|.
49244924

runtime/doc/ui.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,10 @@ numerical highlight ids to the actual attributes.
314314
`bold`: bold text.
315315
`strikethrough`: struckthrough text.
316316
`underline`: underlined text. The line has `special` color.
317-
`underlineline`: double underlined text. The lines have `special`
318-
color.
319317
`undercurl`: undercurled text. The curl has `special` color.
320-
`underdot`: underdotted text. The dots have `special` color.
321-
`underdash`: underdashed text. The dashes have `special` color.
318+
`underdouble`: double underlined text. The lines have `special` color.
319+
`underdotted`: underdotted text. The dots have `special` color.
320+
`underdashed`: underdashed text. The dashes have `special` color.
322321
`blend`: Blend level (0-100). Could be used by UIs to
323322
support blending floating windows to the
324323
background or to signal a transparent cursor.
@@ -477,10 +476,10 @@ is not active. New UIs should implement |ui-linegrid| instead.
477476
`bold`: bold text.
478477
`strikethrough`: struckthrough text.
479478
`underline`: underlined text. The line has `special` color.
480-
`underlineline`: double underlined text. The lines have `special` color.
481479
`undercurl`: undercurled text. The curl has `special` color.
482-
`underdot`: underdotted text. The dots have `special` color.
483-
`underdash`: underdashed text. The dashes have `special` color.
480+
`underdouble`: double underlined text. The lines have `special` color.
481+
`underdotted`: underdotted text. The dots have `special` color.
482+
`underdashed`: underdashed text. The dashes have `special` color.
484483

485484
["put", text]
486485
The (utf-8 encoded) string `text` is put at the cursor position

runtime/syntax/vim.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster
572572

573573
syn match vimHiGroup contained "\i\+"
574574
syn case ignore
575-
syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline underlineline undercurl underdot underdash
575+
syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdouble underdotted underdashed
576576
syn keyword vimFgBgAttrib contained none bg background fg foreground
577577
syn case match
578578
syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib

src/nvim/api/keysets.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ return {
9595
"standout";
9696
"strikethrough";
9797
"underline";
98-
"underlineline";
9998
"undercurl";
100-
"underdot";
101-
"underdash";
99+
"underdouble";
100+
"underdotted";
101+
"underdashed";
102102
"italic";
103103
"reverse";
104104
"nocombine";
@@ -120,10 +120,10 @@ return {
120120
"standout";
121121
"strikethrough";
122122
"underline";
123-
"underlineline";
124123
"undercurl";
125-
"underdot";
126-
"underdash";
124+
"underdouble";
125+
"underdotted";
126+
"underdashed";
127127
"italic";
128128
"reverse";
129129
"nocombine";

src/nvim/api/vim.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ Dictionary nvim__get_hl_defs(Integer ns_id, Error *err)
149149
/// - bold: boolean
150150
/// - standout: boolean
151151
/// - underline: boolean
152-
/// - underlineline: boolean
153152
/// - undercurl: boolean
154-
/// - underdot: boolean
155-
/// - underdash: boolean
153+
/// - underdouble: boolean
154+
/// - underdotted: boolean
155+
/// - underdashed: boolean
156156
/// - strikethrough: boolean
157157
/// - italic: boolean
158158
/// - reverse: boolean

src/nvim/eval/funcs.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10303,22 +10303,30 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
1030310303
p = highlight_has_attr(id, HL_STANDOUT, modec);
1030410304
}
1030510305
break;
10306-
case 'u': {
10307-
const size_t len = STRLEN(what);
10308-
if (len <= 5 || (TOLOWER_ASC(what[5]) == 'l' && len <= 9)) { // underline
10309-
p = highlight_has_attr(id, HL_UNDERLINE, modec);
10310-
} else if (TOLOWER_ASC(what[5]) == 'c') { // undercurl
10311-
p = highlight_has_attr(id, HL_UNDERCURL, modec);
10312-
} else if (len > 9 && TOLOWER_ASC(what[9]) == 'l') { // underlineline
10313-
p = highlight_has_attr(id, HL_UNDERLINELINE, modec);
10314-
} else if (len > 6 && TOLOWER_ASC(what[6]) == 'o') { // underdot
10315-
p = highlight_has_attr(id, HL_UNDERDOT, modec);
10316-
} else { // underdash
10317-
p = highlight_has_attr(id, HL_UNDERDASH, modec);
10306+
case 'u':
10307+
if (STRLEN(what) >= 9) {
10308+
if (TOLOWER_ASC(what[5]) == 'l') {
10309+
// underline
10310+
p = highlight_has_attr(id, HL_UNDERLINE, modec);
10311+
} else if (TOLOWER_ASC(what[5]) != 'd') {
10312+
// undercurl
10313+
p = highlight_has_attr(id, HL_UNDERCURL, modec);
10314+
} else if (TOLOWER_ASC(what[6]) != 'o') {
10315+
// underdashed
10316+
p = highlight_has_attr(id, HL_UNDERDASHED, modec);
10317+
} else if (TOLOWER_ASC(what[7]) == 'u') {
10318+
// underdouble
10319+
p = highlight_has_attr(id, HL_UNDERDOUBLE, modec);
10320+
} else {
10321+
// underdotted
10322+
p = highlight_has_attr(id, HL_UNDERDOTTED, modec);
10323+
}
10324+
} else {
10325+
// ul
10326+
p = highlight_color(id, what, modec);
1031810327
}
1031910328
break;
1032010329
}
10321-
}
1032210330

1032310331
rettv->v_type = VAR_STRING;
1032410332
rettv->vval.v_string = (char *)(p == NULL ? p : xstrdup(p));

src/nvim/hardcopy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
419419
pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL);
420420
pattr->italic = (highlight_has_attr(hl_id, HL_ITALIC, modec) != NULL);
421421
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL);
422-
pattr->underlineline = (highlight_has_attr(hl_id, HL_UNDERLINELINE, modec) != NULL);
423422
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
424-
pattr->underdot = (highlight_has_attr(hl_id, HL_UNDERDOT, modec) != NULL);
425-
pattr->underdash = (highlight_has_attr(hl_id, HL_UNDERDASH, modec) != NULL);
423+
pattr->underdouble = (highlight_has_attr(hl_id, HL_UNDERDOUBLE, modec) != NULL);
424+
pattr->underdotted = (highlight_has_attr(hl_id, HL_UNDERDOTTED, modec) != NULL);
425+
pattr->underdashed = (highlight_has_attr(hl_id, HL_UNDERDASHED, modec) != NULL);
426426

427427
uint32_t fg_color = prt_get_color(hl_id, modec);
428428

src/nvim/hardcopy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ typedef struct {
1818
TriState italic;
1919
TriState underline;
2020
int undercurl;
21-
int underlineline;
22-
int underdot;
23-
int underdash;
21+
int underdouble;
22+
int underdotted;
23+
int underdashed;
2424
} prt_text_attr_T;
2525

2626
/*

src/nvim/highlight.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -743,20 +743,20 @@ Dictionary hlattrs2dict(HlAttrs ae, bool use_rgb)
743743
PUT(hl, "underline", BOOLEAN_OBJ(true));
744744
}
745745

746-
if (mask & HL_UNDERLINELINE) {
747-
PUT(hl, "underlineline", BOOLEAN_OBJ(true));
748-
}
749-
750746
if (mask & HL_UNDERCURL) {
751747
PUT(hl, "undercurl", BOOLEAN_OBJ(true));
752748
}
753749

754-
if (mask & HL_UNDERDOT) {
755-
PUT(hl, "underdot", BOOLEAN_OBJ(true));
750+
if (mask & HL_UNDERDOUBLE) {
751+
PUT(hl, "underdouble", BOOLEAN_OBJ(true));
752+
}
753+
754+
if (mask & HL_UNDERDOTTED) {
755+
PUT(hl, "underdotted", BOOLEAN_OBJ(true));
756756
}
757757

758-
if (mask & HL_UNDERDASH) {
759-
PUT(hl, "underdash", BOOLEAN_OBJ(true));
758+
if (mask & HL_UNDERDASHED) {
759+
PUT(hl, "underdashed", BOOLEAN_OBJ(true));
760760
}
761761

762762
if (mask & HL_ITALIC) {
@@ -825,10 +825,10 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
825825
CHECK_FLAG(dict, mask, bold, , HL_BOLD);
826826
CHECK_FLAG(dict, mask, standout, , HL_STANDOUT);
827827
CHECK_FLAG(dict, mask, underline, , HL_UNDERLINE);
828-
CHECK_FLAG(dict, mask, underlineline, , HL_UNDERLINELINE);
829828
CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL);
830-
CHECK_FLAG(dict, mask, underdot, , HL_UNDERDOT);
831-
CHECK_FLAG(dict, mask, underdash, , HL_UNDERDASH);
829+
CHECK_FLAG(dict, mask, underdouble, , HL_UNDERDOUBLE);
830+
CHECK_FLAG(dict, mask, underdotted, , HL_UNDERDOTTED);
831+
CHECK_FLAG(dict, mask, underdashed, , HL_UNDERDASHED);
832832
CHECK_FLAG(dict, mask, italic, , HL_ITALIC);
833833
CHECK_FLAG(dict, mask, reverse, , HL_INVERSE);
834834
CHECK_FLAG(dict, mask, strikethrough, , HL_STRIKETHROUGH);

src/nvim/highlight_defs.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ typedef enum {
1717
HL_ITALIC = 0x04,
1818
HL_UNDERLINE = 0x08,
1919
HL_UNDERCURL = 0x10,
20-
HL_STANDOUT = 0x20,
21-
HL_STRIKETHROUGH = 0x40,
22-
HL_NOCOMBINE = 0x80,
23-
HL_BG_INDEXED = 0x0100,
24-
HL_FG_INDEXED = 0x0200,
25-
HL_DEFAULT = 0x0400,
26-
HL_GLOBAL = 0x0800,
27-
HL_UNDERLINELINE = 0x1000,
28-
HL_UNDERDOT = 0x2000,
29-
HL_UNDERDASH = 0x4000,
30-
HL_ANY_UNDERLINE = HL_UNDERLINE | HL_UNDERLINELINE | HL_UNDERCURL | HL_UNDERDOT | HL_UNDERDASH,
20+
HL_UNDERDOUBLE = 0x20,
21+
HL_UNDERDOTTED = 0x40,
22+
HL_UNDERDASHED = 0x80,
23+
HL_STANDOUT = 0x0100,
24+
HL_NOCOMBINE = 0x0200,
25+
HL_STRIKETHROUGH = 0x0400,
26+
HL_BG_INDEXED = 0x0800,
27+
HL_FG_INDEXED = 0x1000,
28+
HL_DEFAULT = 0x2000,
29+
HL_GLOBAL = 0x4000,
30+
HL_ANY_UNDERLINE = HL_UNDERLINE | HL_UNDERDOUBLE | HL_UNDERCURL | HL_UNDERDOTTED | HL_UNDERDASHED,
3131
} HlAttrFlags;
3232

3333
/// Stores a complete highlighting entry, including colors and attributes

src/nvim/highlight_group.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ Map(cstr_t, int) highlight_unames = MAP_INIT;
3838
/// The "term", "cterm" and "gui" arguments can be any combination of the
3939
/// following names, separated by commas (but no spaces!).
4040
static char *(hl_name_table[]) =
41-
{ "bold", "standout", "underline", "underlineline", "undercurl", "underdot",
42-
"underdash", "italic", "reverse", "inverse", "strikethrough", "nocombine", "NONE" };
41+
{ "bold", "standout", "underline",
42+
"undercurl", "underdouble", "underdotted", "underdashed",
43+
"italic", "reverse", "inverse", "strikethrough", "nocombine", "NONE" };
4344
static int hl_attr_table[] =
44-
{ HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERLINELINE, HL_UNDERCURL, HL_UNDERDOT, HL_UNDERDASH,
45+
{ HL_BOLD, HL_STANDOUT, HL_UNDERLINE,
46+
HL_UNDERCURL, HL_UNDERDOUBLE, HL_UNDERDOTTED, HL_UNDERDASHED,
4547
HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_STRIKETHROUGH, HL_NOCOMBINE, 0 };
4648

4749
/// Structure that stores information about a highlight group.

src/nvim/tui/tui.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -589,26 +589,26 @@ static void update_attrs(UI *ui, int attr_id)
589589
bool strikethrough = attr & HL_STRIKETHROUGH;
590590

591591
bool underline;
592-
bool underlineline;
593592
bool undercurl;
594-
bool underdot;
595-
bool underdash;
593+
bool underdouble;
594+
bool underdotted;
595+
bool underdashed;
596596
if (data->unibi_ext.set_underline_style != -1) {
597597
underline = attr & HL_UNDERLINE;
598-
underlineline = attr & HL_UNDERLINELINE;
599598
undercurl = attr & HL_UNDERCURL;
600-
underdash = attr & HL_UNDERDASH;
601-
underdot = attr & HL_UNDERDOT;
599+
underdouble = attr & HL_UNDERDOUBLE;
600+
underdashed = attr & HL_UNDERDASHED;
601+
underdotted = attr & HL_UNDERDOTTED;
602602
} else {
603603
underline = attr & HL_ANY_UNDERLINE;
604-
underlineline = false;
605604
undercurl = false;
606-
underdot = false;
607-
underdash = false;
605+
underdouble = false;
606+
underdotted = false;
607+
underdashed = false;
608608
}
609609

610610
bool has_any_underline = undercurl || underline
611-
|| underdot || underdash || underlineline;
611+
|| underdouble || underdotted || underdashed;
612612

613613
if (unibi_get_str(data->ut, unibi_set_attributes)) {
614614
if (bold || reverse || underline || standout) {
@@ -648,19 +648,19 @@ static void update_attrs(UI *ui, int attr_id)
648648
if (strikethrough && data->unibi_ext.enter_strikethrough_mode != -1) {
649649
unibi_out_ext(ui, data->unibi_ext.enter_strikethrough_mode);
650650
}
651-
if (underlineline && data->unibi_ext.set_underline_style != -1) {
652-
UNIBI_SET_NUM_VAR(data->params[0], 2);
653-
unibi_out_ext(ui, data->unibi_ext.set_underline_style);
654-
}
655651
if (undercurl && data->unibi_ext.set_underline_style != -1) {
656652
UNIBI_SET_NUM_VAR(data->params[0], 3);
657653
unibi_out_ext(ui, data->unibi_ext.set_underline_style);
658654
}
659-
if (underdot && data->unibi_ext.set_underline_style != -1) {
655+
if (underdouble && data->unibi_ext.set_underline_style != -1) {
656+
UNIBI_SET_NUM_VAR(data->params[0], 2);
657+
unibi_out_ext(ui, data->unibi_ext.set_underline_style);
658+
}
659+
if (underdotted && data->unibi_ext.set_underline_style != -1) {
660660
UNIBI_SET_NUM_VAR(data->params[0], 4);
661661
unibi_out_ext(ui, data->unibi_ext.set_underline_style);
662662
}
663-
if (underdash && data->unibi_ext.set_underline_style != -1) {
663+
if (underdashed && data->unibi_ext.set_underline_style != -1) {
664664
UNIBI_SET_NUM_VAR(data->params[0], 5);
665665
unibi_out_ext(ui, data->unibi_ext.set_underline_style);
666666
}

0 commit comments

Comments
 (0)