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: #17606
closes: #17662

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-07-05 15:31:23 +02:00
committed by Christian Brabandt
parent a8b86605f3
commit 96b3ef2389
12 changed files with 92 additions and 64 deletions

View File

@ -4556,6 +4556,35 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
ExpandCleanup(&xpc);
}
/*
* "getcompletiontype()" function
*/
void
f_getcompletiontype(typval_T *argvars, typval_T *rettv)
{
char_u *pat;
expand_T xpc;
int cmdline_len;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
if (check_for_string_arg(argvars, 0) == FAIL)
return;
pat = tv_get_string(&argvars[0]);
ExpandInit(&xpc);
cmdline_len = (int)STRLEN(pat);
set_cmd_context(&xpc, pat, cmdline_len, cmdline_len, FALSE);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
xpc.xp_col = cmdline_len;
rettv->vval.v_string = get_cmdline_completion(&xpc);
ExpandCleanup(&xpc);
}
/*
* "cmdcomplete_info()" function
*/