@@ -32,6 +32,7 @@ struct sign
3232 char_u * sn_text ; // text used instead of pixmap
3333 int sn_line_hl ; // highlight ID for line
3434 int sn_text_hl ; // highlight ID for text
35+ int sn_cul_hl ; // highlight ID for text on current line when 'cursorline' is set
3536};
3637
3738static sign_T * first_sign = NULL ;
@@ -517,6 +518,8 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
517518 sattr -> sat_texthl = syn_id2attr (sp -> sn_text_hl );
518519 if (sp -> sn_line_hl > 0 )
519520 sattr -> sat_linehl = syn_id2attr (sp -> sn_line_hl );
521+ if (sp -> sn_cul_hl > 0 )
522+ sattr -> sat_culhl = syn_id2attr (sp -> sn_cul_hl );
520523 sattr -> sat_priority = sign -> se_priority ;
521524
522525 // If there is another sign next with the same priority, may
@@ -540,6 +543,8 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr)
540543 sattr -> sat_texthl = syn_id2attr (next_sp -> sn_text_hl );
541544 if (sp -> sn_line_hl <= 0 && next_sp -> sn_line_hl > 0 )
542545 sattr -> sat_linehl = syn_id2attr (next_sp -> sn_line_hl );
546+ if (sp -> sn_cul_hl <= 0 && next_sp -> sn_cul_hl > 0 )
547+ sattr -> sat_culhl = syn_id2attr (next_sp -> sn_cul_hl );
543548 }
544549 }
545550 return TRUE;
@@ -1035,7 +1040,8 @@ sign_define_by_name(
10351040 char_u * icon ,
10361041 char_u * linehl ,
10371042 char_u * text ,
1038- char_u * texthl )
1043+ char_u * texthl ,
1044+ char_u * culhl )
10391045{
10401046 sign_T * sp_prev ;
10411047 sign_T * sp ;
@@ -1077,6 +1083,9 @@ sign_define_by_name(
10771083 if (texthl != NULL )
10781084 sp -> sn_text_hl = syn_check_group (texthl , (int )STRLEN (texthl ));
10791085
1086+ if (culhl != NULL )
1087+ sp -> sn_cul_hl = syn_check_group (culhl , (int )STRLEN (culhl ));
1088+
10801089 return OK ;
10811090}
10821091
@@ -1298,6 +1307,7 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
12981307 char_u * text = NULL ;
12991308 char_u * linehl = NULL ;
13001309 char_u * texthl = NULL ;
1310+ char_u * culhl = NULL ;
13011311 int failed = FALSE;
13021312
13031313 // set values for a defined sign.
@@ -1327,6 +1337,11 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
13271337 arg += 7 ;
13281338 texthl = vim_strnsave (arg , p - arg );
13291339 }
1340+ else if (STRNCMP (arg , "culhl=" , 6 ) == 0 )
1341+ {
1342+ arg += 6 ;
1343+ culhl = vim_strnsave (arg , p - arg );
1344+ }
13301345 else
13311346 {
13321347 semsg (_ (e_invarg2 ), arg );
@@ -1336,12 +1351,13 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
13361351 }
13371352
13381353 if (!failed )
1339- sign_define_by_name (sign_name , icon , linehl , text , texthl );
1354+ sign_define_by_name (sign_name , icon , linehl , text , texthl , culhl );
13401355
13411356 vim_free (icon );
13421357 vim_free (text );
13431358 vim_free (linehl );
13441359 vim_free (texthl );
1360+ vim_free (culhl );
13451361}
13461362
13471363/*
@@ -1712,6 +1728,13 @@ sign_getinfo(sign_T *sp, dict_T *retdict)
17121728 p = (char_u * )"NONE" ;
17131729 dict_add_string (retdict , "texthl" , (char_u * )p );
17141730 }
1731+ if (sp -> sn_cul_hl > 0 )
1732+ {
1733+ p = get_highlight_name_ext (NULL , sp -> sn_cul_hl - 1 , FALSE);
1734+ if (p == NULL )
1735+ p = (char_u * )"NONE" ;
1736+ dict_add_string (retdict , "culhl" , (char_u * )p );
1737+ }
17151738}
17161739
17171740/*
@@ -1883,6 +1906,15 @@ sign_list_defined(sign_T *sp)
18831906 else
18841907 msg_puts ((char * )p );
18851908 }
1909+ if (sp -> sn_cul_hl > 0 )
1910+ {
1911+ msg_puts (" culhl=" );
1912+ p = get_highlight_name_ext (NULL , sp -> sn_cul_hl - 1 , FALSE);
1913+ if (p == NULL )
1914+ msg_puts ("NONE" );
1915+ else
1916+ msg_puts ((char * )p );
1917+ }
18861918}
18871919
18881920/*
@@ -2173,6 +2205,7 @@ sign_define_from_dict(char_u *name_arg, dict_T *dict)
21732205 char_u * linehl = NULL ;
21742206 char_u * text = NULL ;
21752207 char_u * texthl = NULL ;
2208+ char_u * culhl = NULL ;
21762209 int retval = -1 ;
21772210
21782211 if (name_arg == NULL )
@@ -2191,9 +2224,10 @@ sign_define_from_dict(char_u *name_arg, dict_T *dict)
21912224 linehl = dict_get_string (dict , (char_u * )"linehl" , TRUE);
21922225 text = dict_get_string (dict , (char_u * )"text" , TRUE);
21932226 texthl = dict_get_string (dict , (char_u * )"texthl" , TRUE);
2227+ culhl = dict_get_string (dict , (char_u * )"culhl" , TRUE);
21942228 }
21952229
2196- if (sign_define_by_name (name , icon , linehl , text , texthl ) == OK )
2230+ if (sign_define_by_name (name , icon , linehl , text , texthl , culhl ) == OK )
21972231 retval = 0 ;
21982232
21992233cleanup :
@@ -2202,6 +2236,7 @@ sign_define_from_dict(char_u *name_arg, dict_T *dict)
22022236 vim_free (linehl );
22032237 vim_free (text );
22042238 vim_free (texthl );
2239+ vim_free (culhl );
22052240
22062241 return retval ;
22072242}
0 commit comments