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