mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Problem: synIDattr() cannot get the value of ctermul. Solution: Add the "ul" value for "what". (closes #7037)
This commit is contained in:
parent
d569a9e746
commit
391c362794
@ -10348,7 +10348,9 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
|
|||||||
"bg" background color (as with "fg")
|
"bg" background color (as with "fg")
|
||||||
"font" font name (only available in the GUI)
|
"font" font name (only available in the GUI)
|
||||||
|highlight-font|
|
|highlight-font|
|
||||||
"sp" special color (as with "fg") |highlight-guisp|
|
"sp" special color for the GUI (as with "fg")
|
||||||
|
|highlight-guisp|
|
||||||
|
"ul" underline color for cterm: number as a string
|
||||||
"fg#" like "fg", but for the GUI and the GUI is
|
"fg#" like "fg", but for the GUI and the GUI is
|
||||||
running the name in "#RRGGBB" form
|
running the name in "#RRGGBB" form
|
||||||
"bg#" like "fg#" for "bg"
|
"bg#" like "fg#" for "bg"
|
||||||
|
@ -8604,7 +8604,9 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
|
if (TOLOWER_ASC(what[1]) == 'l') // ul
|
||||||
|
p = highlight_color(id, what, modec);
|
||||||
|
else if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
|
||||||
// underline
|
// underline
|
||||||
p = highlight_has_attr(id, HL_UNDERLINE, modec);
|
p = highlight_has_attr(id, HL_UNDERLINE, modec);
|
||||||
else
|
else
|
||||||
|
@ -2684,13 +2684,14 @@ highlight_has_attr(
|
|||||||
char_u *
|
char_u *
|
||||||
highlight_color(
|
highlight_color(
|
||||||
int id,
|
int id,
|
||||||
char_u *what, // "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#"
|
char_u *what, // "font", "fg", "bg", "sp", "ul", "fg#", "bg#" or "sp#"
|
||||||
int modec) // 'g' for GUI, 'c' for cterm, 't' for term
|
int modec) // 'g' for GUI, 'c' for cterm, 't' for term
|
||||||
{
|
{
|
||||||
static char_u name[20];
|
static char_u name[20];
|
||||||
int n;
|
int n;
|
||||||
int fg = FALSE;
|
int fg = FALSE;
|
||||||
int sp = FALSE;
|
int sp = FALSE;
|
||||||
|
int ul = FALSE;
|
||||||
int font = FALSE;
|
int font = FALSE;
|
||||||
|
|
||||||
if (id <= 0 || id > highlight_ga.ga_len)
|
if (id <= 0 || id > highlight_ga.ga_len)
|
||||||
@ -2703,6 +2704,8 @@ highlight_color(
|
|||||||
font = TRUE;
|
font = TRUE;
|
||||||
else if (TOLOWER_ASC(what[0]) == 's' && TOLOWER_ASC(what[1]) == 'p')
|
else if (TOLOWER_ASC(what[0]) == 's' && TOLOWER_ASC(what[1]) == 'p')
|
||||||
sp = TRUE;
|
sp = TRUE;
|
||||||
|
else if (TOLOWER_ASC(what[0]) == 'u' && TOLOWER_ASC(what[1]) == 'l')
|
||||||
|
ul = TRUE;
|
||||||
else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g'))
|
else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g'))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (modec == 'g')
|
if (modec == 'g')
|
||||||
@ -2749,6 +2752,8 @@ highlight_color(
|
|||||||
{
|
{
|
||||||
if (fg)
|
if (fg)
|
||||||
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
|
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
|
||||||
|
else if (ul)
|
||||||
|
n = HL_TABLE()[id - 1].sg_cterm_ul - 1;
|
||||||
else
|
else
|
||||||
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
|
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
|
@ -808,6 +808,7 @@ func Test_highlight_ctermul()
|
|||||||
call assert_notmatch('ctermul=', HighlightArgs('Normal'))
|
call assert_notmatch('ctermul=', HighlightArgs('Normal'))
|
||||||
highlight Normal ctermul=3
|
highlight Normal ctermul=3
|
||||||
call assert_match('ctermul=3', HighlightArgs('Normal'))
|
call assert_match('ctermul=3', HighlightArgs('Normal'))
|
||||||
|
call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul'))
|
||||||
highlight Normal ctermul=NONE
|
highlight Normal ctermul=NONE
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1771,
|
||||||
/**/
|
/**/
|
||||||
1770,
|
1770,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user