aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-01 15:43:38 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-01 21:54:18 +0800
commit34e7dc5d051918dc9df3d7bd8309a9a4974e7874 (patch)
treedfd97534a26b53655c5a7ab4a6493303d260cae9 /src/nvim/testdir
parent7d45f1a5e8d05000a174dac149b56217c82e0214 (diff)
downloadrneovim-34e7dc5d051918dc9df3d7bd8309a9a4974e7874.tar.gz
rneovim-34e7dc5d051918dc9df3d7bd8309a9a4974e7874.tar.bz2
rneovim-34e7dc5d051918dc9df3d7bd8309a9a4974e7874.zip
vim-patch:8.2.2804: setting buffer local mapping with mapset() changes global
Problem: Setting buffer local mapping with mapset() changes global mapping. Solution: Only set the local mapping. (closes vim/vim#8143) https://github.com/vim/vim/commit/7ba1e4d363164e32a93cceab64b42e8c6d89e9f3
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_maparg.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_maparg.vim b/src/nvim/testdir/test_maparg.vim
index 6b69def374..0bade1df7f 100644
--- a/src/nvim/testdir/test_maparg.vim
+++ b/src/nvim/testdir/test_maparg.vim
@@ -253,6 +253,27 @@ func Check_ctrlb_map(d, check_alt)
endif
endfunc
+func Test_map_local()
+ nmap a global
+ nmap <buffer>a local
+
+ let prev_map_list = split(execute('nmap a'), "\n")
+ call assert_match('n\s*a\s*@local', prev_map_list[0])
+ call assert_match('n\s*a\s*global', prev_map_list[1])
+
+ let mapping = maparg('a', 'n', 0, 1)
+ call assert_equal(1, mapping.buffer)
+ let mapping.rhs = 'new_local'
+ call mapset('n', 0, mapping)
+
+ " Check that the global mapping is left untouched.
+ let map_list = split(execute('nmap a'), "\n")
+ call assert_match('n\s*a\s*@new_local', map_list[0])
+ call assert_match('n\s*a\s*global', map_list[1])
+
+ nunmap a
+endfunc
+
func Test_map_restore()
" Test restoring map with alternate keycode
nmap <C-B> back