mirror of
https://github.com/vim/vim.git
synced 2025-10-05 05:34:07 -04:00
patch 9.0.1442: mapset() does not restore non-script context
Problem: mapset() does not restore non-script context. Solution: Also accept negative sid. (closes #12132)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
" Tests for maparg(), mapcheck(), mapset(), maplist()
|
||||
" Also test utf8 map with a 0x80 byte.
|
||||
|
||||
source shared.vim
|
||||
|
||||
func s:SID()
|
||||
return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$'))
|
||||
endfunc
|
||||
@@ -490,7 +492,28 @@ func Test_map_restore()
|
||||
call Check_ctrlb_map(dsimp, 0)
|
||||
|
||||
nunmap <C-B>
|
||||
endfunc
|
||||
|
||||
" Test restoring the script context of a mapping
|
||||
func Test_map_restore_sid()
|
||||
let after =<< trim [CODE]
|
||||
call assert_equal("\tLast set from --cmd argument",
|
||||
\ execute('verbose nmap ,n')->trim()->split("\n")[-1])
|
||||
let d = maparg(',n', 'n', 0, 1)
|
||||
nunmap ,n
|
||||
call assert_equal('No mapping found',
|
||||
\ execute('verbose nmap ,n')->trim()->split("\n")[-1])
|
||||
call mapset('n', 0, d)
|
||||
call assert_equal("\tLast set from --cmd argument",
|
||||
\ execute('verbose nmap ,n')->trim()->split("\n")[-1])
|
||||
call writefile(v:errors, 'Xresult')
|
||||
qall!
|
||||
[CODE]
|
||||
|
||||
if RunVim([], after, '--clean --cmd "nmap ,n <Nop>"')
|
||||
call assert_equal([], readfile('Xresult'))
|
||||
endif
|
||||
call delete('Xresult')
|
||||
endfunc
|
||||
|
||||
def Test_maplist()
|
||||
|
Reference in New Issue
Block a user