mirror of
https://github.com/neovim/neovim.git
synced 2025-10-13 13:26:06 +00:00
vim-patch:9.1.1509: patch 9.1.1505 was not good
Problem: Patch 9.1.1505 was not good
Solution: Revert "patch 9.1.1505: not possible to return completion type
for :ex command" and instead add the getcompletiontype()
function (Hirohito Higashi).
related: vim/vim#17606
closes: vim/vim#17662
96b3ef2389
Cherry-pick Test_multibyte_expression() from Vim, as it passes.
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
@@ -4197,8 +4197,8 @@ static char *get_cmdline_completion_pattern(void)
|
||||
return xstrdup(compl_pat);
|
||||
}
|
||||
|
||||
/// Get the current command-line completion type.
|
||||
static char *get_cmdline_completion(expand_T *xpc)
|
||||
/// Get the command-line completion type.
|
||||
char *get_cmdline_completion(expand_T *xpc)
|
||||
{
|
||||
int xp_context = xpc->xp_context;
|
||||
if (xp_context == EXPAND_NOTHING) {
|
||||
@@ -4235,34 +4235,15 @@ void f_getcmdcomplpat(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
/// "getcmdcompltype()" function
|
||||
void f_getcmdcompltype(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
{
|
||||
if (tv_check_for_opt_string_arg(argvars, 0) == FAIL) {
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
CmdlineInfo *p = get_ccline_ptr();
|
||||
if (cmdline_star > 0 || p == NULL || p->xpc == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
|
||||
if (argvars[0].v_type != VAR_UNKNOWN) {
|
||||
char *pat = (char *)tv_get_string(&argvars[0]);
|
||||
expand_T xpc;
|
||||
ExpandInit(&xpc);
|
||||
|
||||
int cmdline_len = (int)strlen(pat);
|
||||
set_cmd_context(&xpc, pat, cmdline_len, cmdline_len, false);
|
||||
xpc.xp_pattern_len = strlen(xpc.xp_pattern);
|
||||
xpc.xp_col = cmdline_len;
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_cmdline_completion(&xpc);
|
||||
|
||||
ExpandCleanup(&xpc);
|
||||
} else {
|
||||
CmdlineInfo *p = get_ccline_ptr();
|
||||
if (cmdline_star > 0 || p == NULL || p->xpc == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
rettv->vval.v_string = get_cmdline_completion(p->xpc);
|
||||
}
|
||||
rettv->vval.v_string = get_cmdline_completion(p->xpc);
|
||||
}
|
||||
|
||||
/// "getcmdline()" function
|
||||
|
Reference in New Issue
Block a user