@@ -70,9 +70,14 @@ static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
7070static char * (p_kpc_protocol_values []) = {"none" , "mok2" , "kitty" , NULL };
7171#ifdef FEAT_PROP_POPUP
7272// Note: Keep this in sync with parse_popup_option()
73- static char * (p_popup_option_values []) = { "align:" , "border:" , "height:" ,
74- "highlight:" , "shadow:" , "width:" , NULL };
75- static char * (p_popup_option_border_values []) = {"on" , "off" , NULL };
73+ static char * (p_popup_cpp_option_values []) = {"align:" , "border:" ,
74+ "borderhighlight:" , "close:" , "height:" , "highlight:" , "resize:" ,
75+ "shadow:" , "width:" , NULL };
76+ static char * (p_popup_pvp_option_values []) = {"height:" , "highlight:" ,
77+ "width:" , NULL };
78+ static char * (p_popup_option_on_off_values []) = {"on" , "off" , NULL };
79+ static char * (p_popup_cpp_border_values []) = {"single" , "double" , "round" ,
80+ "ascii" , "on" , "off" , "custom:" , NULL };
7681static char * (p_popup_option_align_values []) = {"item" , "menu" , NULL };
7782#endif
7883#if defined(FEAT_SPELL )
@@ -3408,22 +3413,44 @@ did_set_previewpopup(optset_T *args UNUSED)
34083413 return NULL ;
34093414}
34103415
3411- int
3412- expand_set_popupoption (optexpand_T * args , int * numMatches , char_u * * * matches )
3416+ static int
3417+ expand_set_popupoption (optexpand_T * args , int * numMatches , char_u * * * matches ,
3418+ int previewpopup )
34133419{
34143420 expand_T * xp = args -> oe_xp ;
34153421
34163422 if (xp -> xp_pattern > args -> oe_set_arg && * (xp -> xp_pattern - 1 ) == ':' )
34173423 {
34183424 // Within "highlight:"/"border:"/"align:", we have a subgroup of possible options.
34193425 int border_len = (int )STRLEN ("border:" );
3420- if (xp -> xp_pattern - args -> oe_set_arg >= border_len &&
3421- STRNCMP (xp -> xp_pattern - border_len , "border:" , border_len ) == 0 )
3426+ int close_len = (int )STRLEN ("close:" );
3427+ int resize_len = (int )STRLEN ("resize:" );
3428+ int shadow_len = (int )STRLEN ("shadow:" );
3429+ int is_border = xp -> xp_pattern - args -> oe_set_arg >= border_len &&
3430+ STRNCMP (xp -> xp_pattern - border_len , "border:" , border_len ) == 0 ;
3431+ int is_close = xp -> xp_pattern - args -> oe_set_arg >= close_len &&
3432+ STRNCMP (xp -> xp_pattern - close_len , "close:" , close ) == 0 ;
3433+ int is_resize = xp -> xp_pattern - args -> oe_set_arg >= resize_len &&
3434+ STRNCMP (xp -> xp_pattern - resize_len , "resize:" , resize_len ) == 0 ;
3435+ int is_shadow = xp -> xp_pattern - args -> oe_set_arg >= shadow_len &&
3436+ STRNCMP (xp -> xp_pattern - shadow_len , "shadow:" , shadow_len ) == 0 ;
3437+ if (is_close || is_resize || is_shadow )
3438+ {
3439+ return expand_set_opt_string (
3440+ args ,
3441+ p_popup_option_on_off_values ,
3442+ ARRAY_LENGTH (p_popup_option_on_off_values ) - 1 ,
3443+ numMatches ,
3444+ matches );
3445+ }
3446+ if (is_border )
34223447 {
34233448 return expand_set_opt_string (
34243449 args ,
3425- p_popup_option_border_values ,
3426- ARRAY_LENGTH (p_popup_option_border_values ) - 1 ,
3450+ previewpopup ? p_popup_option_on_off_values
3451+ : p_popup_cpp_border_values ,
3452+ (previewpopup ? ARRAY_LENGTH (p_popup_option_on_off_values )
3453+ : ARRAY_LENGTH (p_popup_cpp_border_values )) - 1 ,
34273454 numMatches ,
34283455 matches );
34293456 }
@@ -3439,8 +3466,15 @@ expand_set_popupoption(optexpand_T *args, int *numMatches, char_u ***matches)
34393466 matches );
34403467 }
34413468 int highlight_len = (int )STRLEN ("highlight:" );
3442- if (xp -> xp_pattern - args -> oe_set_arg >= highlight_len &&
3443- STRNCMP (xp -> xp_pattern - highlight_len , "highlight:" , highlight_len ) == 0 )
3469+ int borderhighlight_len = (int )STRLEN ("borderhighlight:" );
3470+ int is_highlight = xp -> xp_pattern - args -> oe_set_arg >= highlight_len
3471+ && STRNCMP (xp -> xp_pattern - highlight_len , "highlight:" ,
3472+ highlight_len ) == 0 ;
3473+ int is_borderhighlight
3474+ = xp -> xp_pattern - args -> oe_set_arg >= borderhighlight_len
3475+ && STRNCMP (xp -> xp_pattern - borderhighlight_len , "highlight:" ,
3476+ borderhighlight_len ) == 0 ;
3477+ if (is_highlight || is_borderhighlight )
34443478 {
34453479 // Return the list of all highlight names
34463480 return expand_set_opt_generic (
@@ -3454,11 +3488,25 @@ expand_set_popupoption(optexpand_T *args, int *numMatches, char_u ***matches)
34543488
34553489 return expand_set_opt_string (
34563490 args ,
3457- p_popup_option_values ,
3458- ARRAY_LENGTH (p_popup_option_values ) - 1 ,
3491+ previewpopup ? p_popup_pvp_option_values
3492+ : p_popup_cpp_option_values ,
3493+ previewpopup ? ARRAY_LENGTH (p_popup_pvp_option_values ) - 1
3494+ : ARRAY_LENGTH (p_popup_cpp_option_values ) - 1 ,
34593495 numMatches ,
34603496 matches );
34613497}
3498+
3499+ int
3500+ expand_set_previewpopup (optexpand_T * args , int * numMatches , char_u * * * matches )
3501+ {
3502+ return expand_set_popupoption (args , numMatches , matches , TRUE);
3503+ }
3504+
3505+ int
3506+ expand_set_completepopup (optexpand_T * args , int * numMatches , char_u * * * matches )
3507+ {
3508+ return expand_set_popupoption (args , numMatches , matches , FALSE);
3509+ }
34623510#endif
34633511
34643512#if defined(FEAT_POSTSCRIPT )
0 commit comments