From beb8f484891f5361cc2ee757b93b4e4aba228612 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 5 May 2022 07:23:27 +0800 Subject: vim-patch:8.2.4867: listing of mapping with K_SPECIAL is wrong (#18419) Problem: Listing of mapping with K_SPECIAL is wrong. Solution: Adjust escaping of special characters. (closes vim/vim#10351) https://github.com/vim/vim/commit/ac402f4d64bec6b6efd809fef52f5b34627bf947 Avoid overshadowing. Cherry-pick Test_list_mapping() from Vim patches 8.2.{0148,2994}. Fix rhs_is_noop. --- src/nvim/testdir/test_mapping.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 752b1700d0..b5158295b4 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -464,6 +464,40 @@ func Test_list_mappings() call assert_equal(['n ,n '], \ execute('nmap ,n')->trim()->split("\n")) + " verbose map + call assert_match("\tLast set from .*/test_mapping.vim line \\d\\+$", + \ execute('verbose map ,n')->trim()->split("\n")[1]) + + " character with K_SPECIAL byte in rhs + nmap foo … + call assert_equal(['n foo …'], + \ execute('nmap foo')->trim()->split("\n")) + + " modified character with K_SPECIAL byte in rhs + nmap foo + call assert_equal(['n foo '], + \ execute('nmap foo')->trim()->split("\n")) + + " character with K_SPECIAL byte in lhs + nmap … foo + call assert_equal(['n … foo'], + \ execute('nmap …')->trim()->split("\n")) + + " modified character with K_SPECIAL byte in lhs + nmap foo + call assert_equal(['n foo'], + \ execute('nmap ')->trim()->split("\n")) + + " map to CTRL-V + exe "nmap ,k \" + call assert_equal(['n ,k '], + \ execute('nmap ,k')->trim()->split("\n")) + + " map with space at the beginning + exe "nmap \ w " + call assert_equal(['n w '], + \ execute("nmap \ w")->trim()->split("\n")) + nmapclear endfunc -- cgit