forked from aniani/vim
updated for version 7.2.389
Problem: synIDattr() cannot return the font. Solution: Support the "font" argument. (Christian Brabandt)
This commit is contained in:
parent
66ca320d9e
commit
12682fda7a
@ -5388,6 +5388,8 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
|
|||||||
the color, cterm: color number as a string,
|
the color, cterm: color number as a string,
|
||||||
term: empty string)
|
term: empty string)
|
||||||
"bg" background color (as with "fg")
|
"bg" background color (as with "fg")
|
||||||
|
"font" font name (only available in the GUI)
|
||||||
|
|highlight-font|
|
||||||
"sp" special color (as with "fg") |highlight-guisp|
|
"sp" special color (as with "fg") |highlight-guisp|
|
||||||
"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
|
||||||
@ -5397,6 +5399,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
|
|||||||
"italic" "1" if italic
|
"italic" "1" if italic
|
||||||
"reverse" "1" if reverse
|
"reverse" "1" if reverse
|
||||||
"inverse" "1" if inverse (= reverse)
|
"inverse" "1" if inverse (= reverse)
|
||||||
|
"standout" "1" if standout
|
||||||
"underline" "1" if underlined
|
"underline" "1" if underlined
|
||||||
"undercurl" "1" if undercurled
|
"undercurl" "1" if undercurled
|
||||||
|
|
||||||
|
@ -16627,7 +16627,7 @@ f_synIDattr(argvars, rettv)
|
|||||||
p = highlight_has_attr(id, HL_BOLD, modec);
|
p = highlight_has_attr(id, HL_BOLD, modec);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f': /* fg[#] */
|
case 'f': /* fg[#] or font */
|
||||||
p = highlight_color(id, what, modec);
|
p = highlight_color(id, what, modec);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
20
src/syntax.c
20
src/syntax.c
@ -8326,7 +8326,7 @@ highlight_has_attr(id, flag, modec)
|
|||||||
char_u *
|
char_u *
|
||||||
highlight_color(id, what, modec)
|
highlight_color(id, what, modec)
|
||||||
int id;
|
int id;
|
||||||
char_u *what; /* "fg", "bg", "sp", "fg#", "bg#" or "sp#" */
|
char_u *what; /* "font", "fg", "bg", "sp", "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];
|
||||||
@ -8334,20 +8334,30 @@ highlight_color(id, what, modec)
|
|||||||
int fg = FALSE;
|
int fg = FALSE;
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
int sp = FALSE;
|
int sp = FALSE;
|
||||||
|
int font = FALSE;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (id <= 0 || id > highlight_ga.ga_len)
|
if (id <= 0 || id > highlight_ga.ga_len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (TOLOWER_ASC(what[0]) == 'f')
|
if (TOLOWER_ASC(what[0]) == 'f' && TOLOWER_ASC(what[1]) == 'g')
|
||||||
fg = TRUE;
|
fg = TRUE;
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
else if (TOLOWER_ASC(what[0]) == 's')
|
else if (TOLOWER_ASC(what[0]) == 'f' && TOLOWER_ASC(what[1]) == 'o'
|
||||||
|
&& TOLOWER_ASC(what[2]) == 'n' && TOLOWER_ASC(what[3]) == 't')
|
||||||
|
font = TRUE;
|
||||||
|
else if (TOLOWER_ASC(what[0]) == 's' && TOLOWER_ASC(what[1]) == 'p')
|
||||||
sp = TRUE;
|
sp = TRUE;
|
||||||
|
else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g'))
|
||||||
|
return NULL;
|
||||||
if (modec == 'g')
|
if (modec == 'g')
|
||||||
{
|
{
|
||||||
|
/* return font name */
|
||||||
|
if (font)
|
||||||
|
return HL_TABLE()[id - 1].sg_font_name;
|
||||||
|
|
||||||
/* return #RRGGBB form (only possible when GUI is running) */
|
/* return #RRGGBB form (only possible when GUI is running) */
|
||||||
if (gui.in_use && what[1] && what[2] == '#')
|
if (gui.in_use && what[2] == '#')
|
||||||
{
|
{
|
||||||
guicolor_T color;
|
guicolor_T color;
|
||||||
long_u rgb;
|
long_u rgb;
|
||||||
@ -8374,6 +8384,8 @@ highlight_color(id, what, modec)
|
|||||||
return (HL_TABLE()[id - 1].sg_gui_sp_name);
|
return (HL_TABLE()[id - 1].sg_gui_sp_name);
|
||||||
return (HL_TABLE()[id - 1].sg_gui_bg_name);
|
return (HL_TABLE()[id - 1].sg_gui_bg_name);
|
||||||
}
|
}
|
||||||
|
if (font || sp)
|
||||||
|
return NULL;
|
||||||
# endif
|
# endif
|
||||||
if (modec == 'c')
|
if (modec == 'c')
|
||||||
{
|
{
|
||||||
|
@ -681,6 +681,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 */
|
||||||
|
/**/
|
||||||
|
389,
|
||||||
/**/
|
/**/
|
||||||
388,
|
388,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user