On Di, 02 Mär 2010, Christian Brabandt wrote:
> Attached patch fixes these problems (also available at
> http://www.256bit.org/~chrisbra/patches/syIDattr.patch). You can now
> query the font attribute using
> gvim -u NONE -c "echo synIDattr(synIDtrans(hlID('Normal')), 'font')"
Grml, I guess, I just found a bug in my Checkattach plugin
(http://www.vim.org/scripts/script.php?script_id=2796). Well, here is
the patch and the plugin is fixed as well.
regards,
Christian
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 0e4631bf9441 runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Fri Feb 26 22:05:22 2010 +0100
+++ b/runtime/doc/eval.txt Tue Mar 02 21:02:32 2010 +0100
@@ -5388,6 +5388,8 @@
the color, cterm: color number as a string,
term: empty string)
"bg" background color (as with "fg")
+ "font" font name (only available in the GUI)
+ |highlight-font|
"sp" special color (as with "fg") |highlight-guisp|
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
@@ -5397,6 +5399,7 @@
"italic" "1" if italic
"reverse" "1" if reverse
"inverse" "1" if inverse (= reverse)
+ "standout" "1" if standout
"underline" "1" if underlined
"undercurl" "1" if undercurled
diff -r 0e4631bf9441 src/eval.c
--- a/src/eval.c Fri Feb 26 22:05:22 2010 +0100
+++ b/src/eval.c Tue Mar 02 21:02:32 2010 +0100
@@ -16627,8 +16626,11 @@
p = highlight_has_attr(id, HL_BOLD, modec);
break;
- case 'f': /* fg[#] */
- p = highlight_color(id, what, modec);
+ case 'f':
+ if (TOLOWER_ASC(what[1]) == 'g') /* fg[#] */
+ p = highlight_color(id, what, modec);
+ else /* font */
+ p = highlight_color(id, what, modec);
break;
case 'i':
diff -r 0e4631bf9441 src/syntax.c
--- a/src/syntax.c Fri Feb 26 22:05:22 2010 +0100
+++ b/src/syntax.c Tue Mar 02 21:02:32 2010 +0100
@@ -8334,20 +8328,24 @@
int fg = FALSE;
# ifdef FEAT_GUI
int sp = FALSE;
+ int fo = FALSE;
# endif
if (id <= 0 || id > highlight_ga.ga_len)
return NULL;
- if (TOLOWER_ASC(what[0]) == 'f')
+ if ((TOLOWER_ASC(what[0]) == 'f') && (TOLOWER_ASC(what[1]) == 'g'))
fg = TRUE;
# ifdef FEAT_GUI
+ else if ((TOLOWER_ASC(what[0]) == 'f') &&
+ (TOLOWER_ASC(what[1]) == 'o'))
+ fo = TRUE;
else if (TOLOWER_ASC(what[0]) == 's')
sp = TRUE;
if (modec == 'g')
{
/* return #RRGGBB form (only possible when GUI is running) */
- if (gui.in_use && what[1] && what[2] == '#')
+ if (gui.in_use && what[1] && (what[2] == '#') || (what[2] == 'n'))
{
guicolor_T color;
long_u rgb;
@@ -8357,6 +8355,8 @@
color = HL_TABLE()[id - 1].sg_gui_fg;
else if (sp)
color = HL_TABLE()[id - 1].sg_gui_sp;
+ else if (fo)
+ return HL_TABLE()[id - 1].sg_font_name;
else
color = HL_TABLE()[id - 1].sg_gui_bg;
if (color == INVALCOLOR)
@@ -8381,6 +8381,8 @@
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
else
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
+ if (n == -1)
+ return NULL;
sprintf((char *)name, "%d", n);
return name;
}