mirror of
https://github.com/vim/vim.git
synced 2025-10-13 06:54:15 -04:00
patch 8.1.1886: command line expansion code is spread out
Problem: Command line expansion code is spread out. Solution: Move the code to cmdexpand.c. (Yegappan Lakshmanan, closes #4831)
This commit is contained in:
@@ -135,9 +135,6 @@ static void f_getchar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcharmod(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcharsearch(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdline(typval_T *argvars, typval_T *rettv);
|
||||
#if defined(FEAT_CMDL_COMPL)
|
||||
static void f_getcompletion(typval_T *argvars, typval_T *rettv);
|
||||
#endif
|
||||
static void f_getcmdpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdtype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdwintype(typval_T *argvars, typval_T *rettv);
|
||||
@@ -4701,79 +4698,6 @@ f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FEAT_CMDL_COMPL)
|
||||
/*
|
||||
* "getcompletion()" function
|
||||
*/
|
||||
static void
|
||||
f_getcompletion(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *pat;
|
||||
expand_T xpc;
|
||||
int filtered = FALSE;
|
||||
int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
|
||||
| WILD_NO_BEEP;
|
||||
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
filtered = tv_get_number_chk(&argvars[2], NULL);
|
||||
|
||||
if (p_wic)
|
||||
options |= WILD_ICASE;
|
||||
|
||||
/* For filtered results, 'wildignore' is used */
|
||||
if (!filtered)
|
||||
options |= WILD_KEEP_ALL;
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_pattern = tv_get_string(&argvars[0]);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_context = cmdcomplete_str_to_type(tv_get_string(&argvars[1]));
|
||||
if (xpc.xp_context == EXPAND_NOTHING)
|
||||
{
|
||||
if (argvars[1].v_type == VAR_STRING)
|
||||
semsg(_(e_invarg2), argvars[1].vval.v_string);
|
||||
else
|
||||
emsg(_(e_invarg));
|
||||
return;
|
||||
}
|
||||
|
||||
# if defined(FEAT_MENU)
|
||||
if (xpc.xp_context == EXPAND_MENUS)
|
||||
{
|
||||
set_context_in_menu_cmd(&xpc, (char_u *)"menu", xpc.xp_pattern, FALSE);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_CSCOPE
|
||||
if (xpc.xp_context == EXPAND_CSCOPE)
|
||||
{
|
||||
set_context_in_cscope_cmd(&xpc, xpc.xp_pattern, CMD_cscope);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
if (xpc.xp_context == EXPAND_SIGN)
|
||||
{
|
||||
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
#endif
|
||||
|
||||
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
|
||||
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
|
||||
{
|
||||
int i;
|
||||
|
||||
ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP);
|
||||
|
||||
for (i = 0; i < xpc.xp_numfiles; i++)
|
||||
list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
|
||||
}
|
||||
vim_free(pat);
|
||||
ExpandCleanup(&xpc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "getcwd()" function
|
||||
*
|
||||
|
Reference in New Issue
Block a user