summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorKota Kato <peony.btn@gmail.com>2022-08-04 18:50:14 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-04 18:50:14 +0100
commit3d3f6ac09859905405f35f50b2b7c57ccf40fb47 (patch)
tree5190bab31b07a6261507939f7281486911f21ec1 /src/evalfunc.c
parent398649ee44edeb309c77361de697320378104b70 (diff)
patch 9.0.0140: execute() does not use the "legacy" command modifierv9.0.0140
Problem: execute() does not use the "legacy" command modifier. Solution: pass the command modifier in sticky_cmdmod_flags. (Kota Kato, closes #10845)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index ef66aedf9a..da2f35e5cf 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3929,6 +3929,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
int save_redir_off = redir_off;
garray_T save_ga;
int save_msg_col = msg_col;
+ int save_sticky_cmdmod_flags = sticky_cmdmod_flags;
int echo_output = FALSE;
rettv->vval.v_string = NULL;
@@ -3985,6 +3986,9 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
if (!echo_output)
msg_col = 0; // prevent leading spaces
+ // For "legacy call execute('cmd')" and "vim9cmd execute('cmd')" apply the
+ // command modifiers to "cmd".
+ sticky_cmdmod_flags = cmdmod.cmod_flags & (CMOD_LEGACY | CMOD_VIM9CMD);
if (cmd != NULL)
do_cmdline_cmd(cmd);
else
@@ -3997,6 +4001,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED);
--list->lv_refcount;
}
+ sticky_cmdmod_flags = save_sticky_cmdmod_flags;
// Need to append a NUL to the result.
if (ga_grow(&redir_execute_ga, 1) == OK)