summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-18 20:31:08 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-18 20:31:08 +0200
commita821b609f9bb9daef032fe1cb8fb95995822e367 (patch)
treeef68f499b294d4983ed4d459a2cb0c133ce03243 /src/ex_getln.c
parenta48637c105ce5ccf6f3296958c889d15dc3faaa4 (diff)
patch 9.1.0498: getcmdcompltype() interferes with cmdline completionv9.1.0498
Problem: getcmdcompltype() interferes with cmdline completion. Solution: Don't set expand context when it's already set. (zeertzjq) closes: #15036 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 3ae4958f8e..3444a0e86e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4176,6 +4176,7 @@ get_cmdline_completion(void)
{
cmdline_info_T *p;
char_u *buffer;
+ int xp_context;
if (cmdline_star > 0)
return NULL;
@@ -4184,15 +4185,21 @@ get_cmdline_completion(void)
if (p == NULL || p->xpc == NULL)
return NULL;
- set_expand_context(p->xpc);
- if (p->xpc->xp_context == EXPAND_UNSUCCESSFUL)
+ 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 *cmd_compl = cmdcomplete_type_to_str(p->xpc->xp_context);
+ char_u *cmd_compl = cmdcomplete_type_to_str(xp_context);
if (cmd_compl == NULL)
return NULL;
- if (p->xpc->xp_context == EXPAND_USER_LIST || p->xpc->xp_context == EXPAND_USER_DEFINED)
+ if (xp_context == EXPAND_USER_LIST || xp_context == EXPAND_USER_DEFINED)
{
buffer = alloc(STRLEN(cmd_compl) + STRLEN(p->xpc->xp_arg) + 2);
if (buffer == NULL)