mirror of
https://github.com/vim/vim.git
synced 2025-10-17 07:44:28 -04:00
patch 9.1.0770: current command line completion is a bit limited
Problem: current command completion is a bit limited Solution: Add the shellcmdline completion type and getmdcomplpat() function (Ruslan Russkikh). closes: #15823 Signed-off-by: Ruslan Russkikh <dvrussk@yandex.ru> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
347d43bd33
commit
0407d621bb
@@ -4204,6 +4204,40 @@ get_cmdline_str(void)
|
||||
return vim_strnsave(p->cmdbuff, p->cmdlen);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current command-line completion pattern.
|
||||
*/
|
||||
static char_u *
|
||||
get_cmdline_completion_pattern(void)
|
||||
{
|
||||
cmdline_info_T *p;
|
||||
int xp_context;
|
||||
|
||||
if (cmdline_star > 0)
|
||||
return NULL;
|
||||
|
||||
p = get_ccline_ptr();
|
||||
if (p == NULL || p->xpc == NULL)
|
||||
return NULL;
|
||||
|
||||
xp_context = p->xpc->xp_context;
|
||||
if (xp_context == EXPAND_NOTHING)
|
||||
{
|
||||
set_expand_context(p->xpc);
|
||||
xp_context = p->xpc->xp_context;
|
||||
p->xpc->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
if (xp_context == EXPAND_UNSUCCESSFUL)
|
||||
return NULL;
|
||||
|
||||
char_u *compl_pat = p->xpc->xp_pattern;
|
||||
|
||||
if (compl_pat == NULL)
|
||||
return NULL;
|
||||
|
||||
return vim_strsave(compl_pat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current command-line completion type.
|
||||
*/
|
||||
@@ -4247,6 +4281,16 @@ get_cmdline_completion(void)
|
||||
return vim_strsave(cmd_compl);
|
||||
}
|
||||
|
||||
/*
|
||||
* "getcmdcomplpat()" function
|
||||
*/
|
||||
void
|
||||
f_getcmdcomplpat(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_cmdline_completion_pattern();
|
||||
}
|
||||
|
||||
/*
|
||||
* "getcmdcompltype()" function
|
||||
*/
|
||||
|
Reference in New Issue
Block a user