To: vim-dev@vim.org
Subject: Patch 7.2.389
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.2.389
Problem: synIDattr() cannot return the font.
Solution: Support the "font" argument. (Christian Brabandt)
Files: runtime/doc/eval.txt, src/eval.c, src/syntax.c
*** ../vim-7.2.388/runtime/doc/eval.txt 2010-01-19 15:51:29.000000000 +0100
--- runtime/doc/eval.txt 2010-03-10 12:52:12.000000000 +0100
***************
*** 5370,5375 ****
--- 5388,5395 ----
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
***************
*** 5379,5384 ****
--- 5399,5405 ----
"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
*** ../vim-7.2.388/src/eval.c 2010-02-24 15:47:58.000000000 +0100
--- src/eval.c 2010-03-10 12:54:27.000000000 +0100
***************
*** 16627,16633 ****
p = highlight_has_attr(id, HL_BOLD, modec);
break;
! case 'f': /* fg[#] */
p = highlight_color(id, what, modec);
break;
--- 16627,16633 ----
p = highlight_has_attr(id, HL_BOLD, modec);
break;
! case 'f': /* fg[#] or font */
p = highlight_color(id, what, modec);
break;
*** ../vim-7.2.388/src/syntax.c 2010-03-02 17:50:30.000000000 +0100
--- src/syntax.c 2010-03-10 13:05:39.000000000 +0100
***************
*** 8326,8332 ****
char_u *
highlight_color(id, what, modec)
int id;
! char_u *what; /* "fg", "bg", "sp", "fg#", "bg#" or "sp#" */
int modec; /* 'g' for GUI, 'c' for cterm, 't' for term */
{
static char_u name[20];
--- 8326,8332 ----
char_u *
highlight_color(id, what, modec)
int id;
! char_u *what; /* "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#" */
int modec; /* 'g' for GUI, 'c' for cterm, 't' for term */
{
static char_u name[20];
***************
*** 8334,8353 ****
int fg = FALSE;
# ifdef FEAT_GUI
int sp = FALSE;
# endif
if (id <= 0 || id > highlight_ga.ga_len)
return NULL;
! if (TOLOWER_ASC(what[0]) == 'f')
fg = TRUE;
# ifdef FEAT_GUI
! 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] == '#')
{
guicolor_T color;
long_u rgb;
--- 8334,8363 ----
int fg = FALSE;
# ifdef FEAT_GUI
int sp = FALSE;
+ int font = FALSE;
# endif
if (id <= 0 || id > highlight_ga.ga_len)
return NULL;
! 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'
! && 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;
+ else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g'))
+ return NULL;
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) */
! if (gui.in_use && what[2] == '#')
{
guicolor_T color;
long_u rgb;
***************
*** 8374,8379 ****
--- 8384,8391 ----
return (HL_TABLE()[id - 1].sg_gui_sp_name);
return (HL_TABLE()[id - 1].sg_gui_bg_name);
}
+ if (font || sp)
+ return NULL;
# endif
if (modec == 'c')
{
*** ../vim-7.2.388/src/version.c 2010-03-10 13:19:28.000000000 +0100
--- src/version.c 2010-03-10 13:33:25.000000000 +0100
***************
*** 683,684 ****
--- 683,686 ----
{ /* Add new patch number below this line */
+ /**/
+ 389,
/**/
--
WOMAN: Dennis, there's some lovely filth down here. Oh -- how d'you do?
ARTHUR: How do you do, good lady. I am Arthur, King of the Britons.
Who's castle is that?
WOMAN: King of the who?
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///