diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-25 13:44:43 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-25 13:44:43 +0100 |
commit | 2095148277cf1c4e7b3bbaf4e34812b7cfe3011b (patch) | |
tree | e4e4c067e47b93ab553db7a83b4f98be3450b04f | |
parent | df980db69b831381c37c3e2973a6eefa10df305c (diff) |
patch 8.0.1425: execute() does not work in completion of user commandv8.0.1425
Problem: execute() does not work in completion of user command. (thinca)
Solution: Switch off redir_off and restore it. (Ozaki Kiichi, closes #2492)
-rw-r--r-- | src/evalfunc.c | 3 | ||||
-rw-r--r-- | src/testdir/test_usercommands.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 764a4db641..0300efea4f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2886,6 +2886,7 @@ f_execute(typval_T *argvars, typval_T *rettv) int save_emsg_silent = emsg_silent; int save_emsg_noredir = emsg_noredir; int save_redir_execute = redir_execute; + int save_redir_off = redir_off; garray_T save_ga; rettv->vval.v_string = NULL; @@ -2928,6 +2929,7 @@ f_execute(typval_T *argvars, typval_T *rettv) save_ga = redir_execute_ga; ga_init2(&redir_execute_ga, (int)sizeof(char), 500); redir_execute = TRUE; + redir_off = FALSE; if (cmd != NULL) do_cmdline_cmd(cmd); @@ -2958,6 +2960,7 @@ f_execute(typval_T *argvars, typval_T *rettv) redir_execute = save_redir_execute; if (redir_execute) redir_execute_ga = save_ga; + redir_off = save_redir_off; /* "silent reg" or "silent echo x" leaves msg_col somewhere in the * line. Put it back in the first column. */ diff --git a/src/testdir/test_usercommands.vim b/src/testdir/test_usercommands.vim index 9420321ac9..21b1c4c0fe 100644 --- a/src/testdir/test_usercommands.vim +++ b/src/testdir/test_usercommands.vim @@ -206,3 +206,15 @@ func Test_CmdCompletion() com! -complete=customlist,CustomComp DoCmd : call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:') endfunc + +func CallExecute(A, L, P) + " Drop first '\n' + return execute('echo "hi"')[1:] +endfunc + +func Test_use_execute_in_completion() + command! -nargs=* -complete=custom,CallExecute DoExec : + call feedkeys(":DoExec \<C-A>\<C-B>\"\<CR>", 'tx') + call assert_equal('"DoExec hi', @:) + delcommand DoExec +endfunc diff --git a/src/version.c b/src/version.c index 4f8dfd29c0..f62287b5b2 100644 --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1425, +/**/ 1424, /**/ 1423, |