@@ -269,6 +269,26 @@ apply_move_options(win_T *wp, dict_T *d)
269269 get_pos_options (wp , d );
270270}
271271
272+ static void
273+ check_highlight (dict_T * dict , char * name , char_u * * pval )
274+ {
275+ dictitem_T * di ;
276+ char_u * str ;
277+
278+ di = dict_find (dict , (char_u * )name , -1 );
279+ if (di != NULL )
280+ {
281+ if (di -> di_tv .v_type != VAR_STRING )
282+ semsg (_ (e_invargval ), name );
283+ else
284+ {
285+ str = tv_get_string (& di -> di_tv );
286+ if (* str != NUL )
287+ * pval = vim_strsave (str );
288+ }
289+ }
290+ }
291+
272292/*
273293 * Shared between popup_create() and f_popup_setoptions().
274294 */
@@ -375,6 +395,9 @@ apply_general_options(win_T *wp, dict_T *dict)
375395 }
376396 }
377397
398+ check_highlight (dict , "scrollbarhighlight" , & wp -> w_scrollbar_highlight );
399+ check_highlight (dict , "thumbhighlight" , & wp -> w_thumb_highlight );
400+
378401 di = dict_find (dict , (char_u * )"zindex" , -1 );
379402 if (di != NULL )
380403 {
@@ -1677,6 +1700,11 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
16771700 dict_add_number (dict , "wrap" , wp -> w_p_wrap );
16781701 dict_add_number (dict , "drag" , wp -> w_popup_drag );
16791702 dict_add_string (dict , "highlight" , wp -> w_p_wcr );
1703+ if (wp -> w_scrollbar_highlight != NULL )
1704+ dict_add_string (dict , "scrollbarhighlight" ,
1705+ wp -> w_scrollbar_highlight );
1706+ if (wp -> w_thumb_highlight != NULL )
1707+ dict_add_string (dict , "thumbhighlight" , wp -> w_thumb_highlight );
16801708
16811709 // find the tabpage that holds this popup
16821710 i = 1 ;
@@ -2131,8 +2159,8 @@ update_popups(void (*win_update)(win_T *wp))
21312159 int i ;
21322160 int sb_thumb_top = 0 ;
21332161 int sb_thumb_height = 0 ;
2134- int attr_scroll = highlight_attr [ HLF_PSB ] ;
2135- int attr_thumb = highlight_attr [ HLF_PST ] ;
2162+ int attr_scroll = 0 ;
2163+ int attr_thumb = 0 ;
21362164
21372165 // Find the window with the lowest zindex that hasn't been updated yet,
21382166 // so that the window with a higher zindex is drawn later, thus goes on
@@ -2246,6 +2274,14 @@ update_popups(void (*win_update)(win_T *wp))
22462274 sb_thumb_top = (wp -> w_topline - 1 + (linecount / wp -> w_height ) / 2 )
22472275 * (wp -> w_height - sb_thumb_height )
22482276 / (linecount - wp -> w_height );
2277+ if (wp -> w_scrollbar_highlight != NULL )
2278+ attr_scroll = syn_name2attr (wp -> w_scrollbar_highlight );
2279+ else
2280+ attr_scroll = highlight_attr [HLF_PSB ];
2281+ if (wp -> w_thumb_highlight != NULL )
2282+ attr_thumb = syn_name2attr (wp -> w_thumb_highlight );
2283+ else
2284+ attr_thumb = highlight_attr [HLF_PST ];
22492285 }
22502286
22512287 for (i = wp -> w_popup_border [0 ];
0 commit comments