diff src/testdir/test_usercommands.vim @ 13101:9b3f8029a326 v8.0.1425

patch 8.0.1425: execute() does not work in completion of user command commit https://github.com/vim/vim/commit/2095148277cf1c4e7b3bbaf4e34812b7cfe3011b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 25 13:44:43 2017 +0100 patch 8.0.1425: execute() does not work in completion of user command Problem: execute() does not work in completion of user command. (thinca) Solution: Switch off redir_off and restore it. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/2492)
author Christian Brabandt <cb@256bit.org>
date Mon, 25 Dec 2017 13:45:05 +0100
parents 1fad9675d8fd
children 39728d503e47
line wrap: on
line diff
--- 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