forked from aniani/vim
patch 8.2.4148: deleting any mapping may cause <ScritpCmd> to fail
Problem: Deleting any mapping may cause <ScritpCmd> to not set the script context. Solution: Only reset last_used_map if it is the deleted mapping. (closes #9568)
This commit is contained in:
@@ -1439,6 +1439,22 @@ func Test_map_script_cmd_finds_func()
|
||||
unlet g:func_called
|
||||
endfunc
|
||||
|
||||
func Test_map_script_cmd_survives_unmap()
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
var n = 123
|
||||
nnoremap <F4> <ScriptCmd><CR>
|
||||
autocmd CmdlineEnter * silent! nunmap <F4>
|
||||
nnoremap <F3> :<ScriptCmd>eval setbufvar(bufnr(), "result", n)<CR>
|
||||
feedkeys("\<F3>\<CR>", 'xct')
|
||||
assert_equal(123, b:result)
|
||||
END
|
||||
call CheckScriptSuccess(lines)
|
||||
|
||||
nunmap <F3>
|
||||
unlet b:result
|
||||
endfunc
|
||||
|
||||
" Test for using <script> with a map to remap characters in rhs
|
||||
func Test_script_local_remap()
|
||||
new
|
||||
|
Reference in New Issue
Block a user