From 27149e0071c3fa38c81526f63a997bedfd6e2be8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 3 May 2022 06:11:22 +0800 Subject: vim-patch:8.2.4858: K_SPECIAL may be escaped twice Problem: K_SPECIAL may be escaped twice. Solution: Avoid double escaping. (closes vim/vim#10340) https://github.com/vim/vim/commit/db08887f24d20be11d184ce321bc0890613e42bd --- src/nvim/testdir/test_eval_stuff.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/nvim/testdir/test_eval_stuff.vim') diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index 95eccde35c..811c6c946d 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -320,4 +320,26 @@ func Test_curly_assignment() unlet g:gvar endfunc +" K_SPECIAL in the modified character used be escaped, which causes +" double-escaping with feedkeys() or as the return value of an mapping, +" and doesn't match what getchar() returns, +func Test_modified_char_no_escape_special() + nnoremap let g:got_m_ellipsis += 1 + call feedkeys("\", 't') + call assert_equal("\", getchar()) + let g:got_m_ellipsis = 0 + call feedkeys("\", 'xt') + call assert_equal(1, g:got_m_ellipsis) + func Func() + return "\" + endfunc + nmap Func() + call feedkeys("\", 'xt') + call assert_equal(2, g:got_m_ellipsis) + delfunc Func + nunmap + unlet g:got_m_ellipsis + nunmap +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit