forked from aniani/vim
patch 9.1.0814: mapset() may remove unrelated mapping
Problem: mapset() may remove unrelated mapping whose {rhs} matches the
restored mapping's {lhs}.
Solution: only match by {lhs} when unmapping for mapset() (zeertzjq).
closes: #15935
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
118072862b
commit
fdf135a052
@@ -540,6 +540,25 @@ func Test_map_restore_negative_sid()
|
||||
call delete('Xresult')
|
||||
endfunc
|
||||
|
||||
" Check that restoring a mapping doesn't remove a mapping whose {rhs} matches
|
||||
" the restored mapping's {lhs}.
|
||||
func Test_map_restore_with_rhs_match_lhs()
|
||||
nnoremap <F2> <F3>
|
||||
nnoremap <F3> <F4>
|
||||
call assert_equal('<F3>', maparg('<F2>', 'n'))
|
||||
call assert_equal('<F4>', maparg('<F3>', 'n'))
|
||||
let d = maparg('<F3>', 'n', v:false, v:true)
|
||||
nunmap <F3>
|
||||
call assert_equal('<F3>', maparg('<F2>', 'n'))
|
||||
call assert_equal('', maparg('<F3>', 'n'))
|
||||
call mapset(d)
|
||||
call assert_equal('<F3>', maparg('<F2>', 'n'))
|
||||
call assert_equal('<F4>', maparg('<F3>', 'n'))
|
||||
|
||||
nunmap <F2>
|
||||
nunmap <F3>
|
||||
endfunc
|
||||
|
||||
def Test_maplist()
|
||||
new
|
||||
def ClearMappingsAbbreviations()
|
||||
|
||||
Reference in New Issue
Block a user