@@ -4571,48 +4571,50 @@ ExpandFromContext(xp, pat, num_file, file, options)
45714571 int context ;
45724572 char_u * ((* func )__ARGS ( (expand_T * , int )));
45734573 int ic ;
4574+ int escaped ;
45744575 } tab [] =
45754576 {
4576- {EXPAND_COMMANDS , get_command_name , FALSE},
4577- {EXPAND_BEHAVE , get_behave_arg , TRUE},
4577+ {EXPAND_COMMANDS , get_command_name , FALSE, TRUE },
4578+ {EXPAND_BEHAVE , get_behave_arg , TRUE, TRUE },
45784579#ifdef FEAT_USR_CMDS
4579- {EXPAND_USER_COMMANDS , get_user_commands , FALSE},
4580- {EXPAND_USER_CMD_FLAGS , get_user_cmd_flags , FALSE},
4581- {EXPAND_USER_NARGS , get_user_cmd_nargs , FALSE},
4582- {EXPAND_USER_COMPLETE , get_user_cmd_complete , FALSE},
4580+ {EXPAND_USER_COMMANDS , get_user_commands , FALSE, TRUE },
4581+ {EXPAND_USER_CMD_FLAGS , get_user_cmd_flags , FALSE, TRUE },
4582+ {EXPAND_USER_NARGS , get_user_cmd_nargs , FALSE, TRUE },
4583+ {EXPAND_USER_COMPLETE , get_user_cmd_complete , FALSE, TRUE },
45834584#endif
45844585#ifdef FEAT_EVAL
4585- {EXPAND_USER_VARS , get_user_var_name , FALSE},
4586- {EXPAND_FUNCTIONS , get_function_name , FALSE},
4587- {EXPAND_USER_FUNC , get_user_func_name , FALSE},
4588- {EXPAND_EXPRESSION , get_expr_name , FALSE},
4586+ {EXPAND_USER_VARS , get_user_var_name , FALSE, TRUE },
4587+ {EXPAND_FUNCTIONS , get_function_name , FALSE, TRUE },
4588+ {EXPAND_USER_FUNC , get_user_func_name , FALSE, TRUE },
4589+ {EXPAND_EXPRESSION , get_expr_name , FALSE, TRUE },
45894590#endif
45904591#ifdef FEAT_MENU
4591- {EXPAND_MENUS , get_menu_name , FALSE},
4592- {EXPAND_MENUNAMES , get_menu_names , FALSE},
4592+ {EXPAND_MENUS , get_menu_name , FALSE, TRUE },
4593+ {EXPAND_MENUNAMES , get_menu_names , FALSE, TRUE },
45934594#endif
45944595#ifdef FEAT_SYN_HL
4595- {EXPAND_SYNTAX , get_syntax_name , TRUE},
4596+ {EXPAND_SYNTAX , get_syntax_name , TRUE, TRUE },
45964597#endif
4597- {EXPAND_HIGHLIGHT , get_highlight_name , TRUE},
4598+ {EXPAND_HIGHLIGHT , get_highlight_name , TRUE, TRUE },
45984599#ifdef FEAT_AUTOCMD
4599- {EXPAND_EVENTS , get_event_name , TRUE},
4600- {EXPAND_AUGROUP , get_augroup_name , TRUE},
4600+ {EXPAND_EVENTS , get_event_name , TRUE, TRUE },
4601+ {EXPAND_AUGROUP , get_augroup_name , TRUE, TRUE },
46014602#endif
46024603#ifdef FEAT_CSCOPE
4603- {EXPAND_CSCOPE , get_cscope_name , TRUE},
4604+ {EXPAND_CSCOPE , get_cscope_name , TRUE, TRUE },
46044605#endif
46054606#ifdef FEAT_SIGNS
4606- {EXPAND_SIGN , get_sign_name , TRUE},
4607+ {EXPAND_SIGN , get_sign_name , TRUE, TRUE },
46074608#endif
46084609#ifdef FEAT_PROFILE
4609- {EXPAND_PROFILE , get_profile_name , TRUE},
4610+ {EXPAND_PROFILE , get_profile_name , TRUE, TRUE },
46104611#endif
46114612#if (defined (HAVE_LOCALE_H ) || defined (X_LOCALE )) \
46124613 && (defined (FEAT_GETTEXT ) || defined (FEAT_MBYTE ))
4613- {EXPAND_LANGUAGE , get_lang_arg , TRUE},
4614+ {EXPAND_LANGUAGE , get_lang_arg , TRUE, FALSE},
4615+ {EXPAND_LOCALES , get_locales , TRUE, FALSE},
46144616#endif
4615- {EXPAND_ENV_VARS , get_env_name , TRUE},
4617+ {EXPAND_ENV_VARS , get_env_name , TRUE, TRUE },
46164618 };
46174619 int i ;
46184620
@@ -4626,7 +4628,8 @@ ExpandFromContext(xp, pat, num_file, file, options)
46264628 {
46274629 if (tab [i ].ic )
46284630 regmatch .rm_ic = TRUE;
4629- ret = ExpandGeneric (xp , & regmatch , num_file , file , tab [i ].func );
4631+ ret = ExpandGeneric (xp , & regmatch , num_file , file ,
4632+ tab [i ].func , tab [i ].escaped );
46304633 break ;
46314634 }
46324635 }
@@ -4648,13 +4651,14 @@ ExpandFromContext(xp, pat, num_file, file, options)
46484651 * Returns OK when no problems encountered, FAIL for error (out of memory).
46494652 */
46504653 int
4651- ExpandGeneric (xp , regmatch , num_file , file , func )
4654+ ExpandGeneric (xp , regmatch , num_file , file , func , escaped )
46524655 expand_T * xp ;
46534656 regmatch_T * regmatch ;
46544657 int * num_file ;
46554658 char_u * * * file ;
46564659 char_u * ((* func )__ARGS ( (expand_T * , int )));
46574660 /* returns a string from the list */
4661+ int escaped ;
46584662{
46594663 int i ;
46604664 int count = 0 ;
@@ -4679,7 +4683,10 @@ ExpandGeneric(xp, regmatch, num_file, file, func)
46794683 {
46804684 if (round )
46814685 {
4682- str = vim_strsave_escaped (str , (char_u * )" \t\\." );
4686+ if (escaped )
4687+ str = vim_strsave_escaped (str , (char_u * )" \t\\." );
4688+ else
4689+ str = vim_strsave (str );
46834690 (* file )[count ] = str ;
46844691#ifdef FEAT_MENU
46854692 if (func == get_menu_names && str != NULL )
0 commit comments