Mercurial > vim
diff src/testdir/test_mapping.vim @ 30102:539fb427124d v9.0.0387
patch 9.0.0387: repeat <ScriptCmd> mapping doesn't use right script context
Commit: https://github.com/vim/vim/commit/ddf7dba96e05a41c7a228b153146237e0a21b146
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 5 16:53:21 2022 +0100
patch 9.0.0387: repeat <ScriptCmd> mapping doesn't use right script context
Problem: repeating a <ScriptCmd> mapping does not use the right script
context.
Solution: When using a mapping put <SID>{sid}; in the redo buffer.
(closes #11049)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Sep 2022 18:00:05 +0200 |
parents | 8a822186f1ab |
children | 72245f9c9405 |
line wrap: on
line diff
--- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -1529,6 +1529,35 @@ func Test_map_script_cmd_survives_unmap( autocmd! CmdlineEnter endfunc +func Test_map_script_cmd_redo() + call mkdir('Xmapcmd') + let lines =<< trim END + vim9script + import autoload './script.vim' + onoremap <F3> <ScriptCmd>script.Func()<CR> + END + call writefile(lines, 'Xmapcmd/plugin.vim') + + let lines =<< trim END + vim9script + export def Func() + normal! dd + enddef + END + call writefile(lines, 'Xmapcmd/script.vim') + new + call setline(1, ['one', 'two', 'three', 'four']) + nnoremap j j + source Xmapcmd/plugin.vim + call feedkeys("d\<F3>j.", 'xt') + call assert_equal(['two', 'four'], getline(1, '$')) + + ounmap <F3> + nunmap j + call delete('Xmapcmd', 'rf') + bwipe! +endfunc + " Test for using <script> with a map to remap characters in rhs func Test_script_local_remap() new