diff src/testdir/test_mapping.vim @ 27156:67194006cad8 v8.2.4107

patch 8.2.4107: script context not restored after using <ScriptCmd> Commit: https://github.com/vim/vim/commit/a9725221ac4650b7e9219bf6e3682826fe2e0096 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 16 13:30:33 2022 +0000 patch 8.2.4107: script context not restored after using <ScriptCmd> Problem: Script context not restored after using <ScriptCmd>. Solution: Also restore context when not in a script. (closes https://github.com/vim/vim/issues/9536) Add the 'c' flag to feedkeys() to be able to test this.
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Jan 2022 14:45:03 +0100
parents 8bb07c88ac27
children 1af5263a4509
line wrap: on
line diff
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -4,6 +4,7 @@ source shared.vim
 source check.vim
 source screendump.vim
 source term_util.vim
+source vim9.vim
 
 func Test_abbreviation()
   " abbreviation with 0x80 should work
@@ -1397,6 +1398,19 @@ func Test_map_cmdkey_redo()
   ounmap i-
 endfunc
 
+func Test_map_script_cmd_restore()
+  let lines =<< trim END
+      vim9script
+      nnoremap <F3> <ScriptCmd>eval 1 + 2<CR>
+  END
+  call CheckScriptSuccess(lines)
+  call feedkeys("\<F3>:let g:result = 3+4\<CR>", 'xtc')
+  call assert_equal(7, g:result)
+
+  nunmap <F3>
+  unlet g:result
+endfunc
+
 " Test for using <script> with a map to remap characters in rhs
 func Test_script_local_remap()
   new