feat(tui): add support for CSI 4 : [2,4,5] m

This commit finishes support for colored and styled underlines adding
`CSI 4 : [2,4,5] m` support providing double, dashed, and dotted
underlines

Fixes #17362.
This commit is contained in:
Kirill Chibisov
2022-03-02 00:48:11 +03:00
parent 7211d8ef21
commit f89fb41a7a
14 changed files with 134 additions and 43 deletions

View File

@@ -11409,14 +11409,22 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
p = highlight_has_attr(id, HL_STANDOUT, modec);
}
break;
case 'u':
if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c') { // underline
p = highlight_has_attr(id, HL_UNDERLINE, modec);
} else { // undercurl
case 'u': {
int len = STRLEN(what);
if (len <= 5 || (TOLOWER_ASC(what[5]) == 'l' && len <= 9)) { // underline
p = highlight_has_attr(id, HL_UNDERCURL, modec);
} else if (TOLOWER_ASC(what[5]) == 'c') { // undercurl
p = highlight_has_attr(id, HL_UNDERCURL, modec);
} else if (len > 9 && TOLOWER_ASC(what[9]) == 'l') { // underlineline
p = highlight_has_attr(id, HL_UNDERLINELINE, modec);
} else if (len > 5 && TOLOWER_ASC(what[6]) == 'o') { // underdot
p = highlight_has_attr(id, HL_UNDERDOT, modec);
} else { // underdash
p = highlight_has_attr(id, HL_UNDERDASH, modec);
}
break;
}
}
rettv->v_type = VAR_STRING;
rettv->vval.v_string = (char_u *)(p == NULL ? p : xstrdup(p));