aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-11 06:48:45 +0800
committerGitHub <noreply@github.com>2024-10-10 22:48:45 +0000
commit6f1601a1b94e6ea724d8436600c64760525d1d2b (patch)
tree547a6639977d43b6ff54fd30345612326cc9706f /src
parentb3109084c2c3675aa886bf16ff15f50025f30096 (diff)
downloadrneovim-6f1601a1b94e6ea724d8436600c64760525d1d2b.tar.gz
rneovim-6f1601a1b94e6ea724d8436600c64760525d1d2b.tar.bz2
rneovim-6f1601a1b94e6ea724d8436600c64760525d1d2b.zip
vim-patch:9.1.0774: "shellcmdline" doesn't work with getcompletion() (#30750)
Problem: "shellcmdline" doesn't work with getcompletion(). Solution: Use set_context_for_wildcard_arg() (zeertzjq). closes: vim/vim#15834 https://github.com/vim/vim/commit/85f36d61e09b12d6f1c60201129823371daa4a84
Diffstat (limited to 'src')
-rw-r--r--src/nvim/cmdexpand.c8
-rw-r--r--src/nvim/eval.lua1
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 45648fc15f..250d705ee6 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -1529,7 +1529,8 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
xp->xp_context = EXPAND_FILES;
// For a shell command more chars need to be escaped.
- if (usefilter || eap->cmdidx == CMD_bang || eap->cmdidx == CMD_terminal
+ if (usefilter
+ || (eap != NULL && (eap->cmdidx == CMD_bang || eap->cmdidx == CMD_terminal))
|| *complp == EXPAND_SHELLCMDLINE) {
#ifndef BACKSLASH_IN_FILENAME
xp->xp_shell = true;
@@ -3604,6 +3605,11 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
set_context_in_runtime_cmd(&xpc, xpc.xp_pattern);
xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
+ if (xpc.xp_context == EXPAND_SHELLCMDLINE) {
+ int context = EXPAND_SHELLCMDLINE;
+ set_context_for_wildcard_arg(NULL, xpc.xp_pattern, false, &xpc, &context);
+ xpc.xp_pattern_len = strlen(xpc.xp_pattern);
+ }
theend:
if (xpc.xp_context == EXPAND_LUA) {
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 24f986ef4e..a440450b9d 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -3775,6 +3775,7 @@ M.funcs = {
runtime |:runtime| completion
scriptnames sourced script names |:scriptnames|
shellcmd Shell command
+ shellcmdline Shell command line with filename arguments
sign |:sign| suboptions
syntax syntax file names |'syntax'|
syntime |:syntime| suboptions