aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-25 07:16:54 +0800
committerGitHub <noreply@github.com>2024-10-24 23:16:54 +0000
commite4a74e986c40ca60ad49ea89020d6a9be36e928b (patch)
tree72dd847fb4ddda9e82fafbc5b77e6c4dc1e037e9 /test
parent54249d051c3e0b97321939e6a3ae3d2e83971ce7 (diff)
downloadrneovim-e4a74e986c40ca60ad49ea89020d6a9be36e928b.tar.gz
rneovim-e4a74e986c40ca60ad49ea89020d6a9be36e928b.tar.bz2
rneovim-e4a74e986c40ca60ad49ea89020d6a9be36e928b.zip
vim-patch:9.1.0814: mapset() may remove unrelated mapping (#30941)
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: vim/vim#15935 https://github.com/vim/vim/commit/fdf135a0525746cc0ff85bed2fbbde320ddb6d0d
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_map_functions.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/old/testdir/test_map_functions.vim b/test/old/testdir/test_map_functions.vim
index 8f7c8bae76..5118063b36 100644
--- a/test/old/testdir/test_map_functions.vim
+++ b/test/old/testdir/test_map_functions.vim
@@ -527,6 +527,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
+
func Test_maplist()
new
func s:ClearMappingsAbbreviations()