From 12662ac0c4160b81f7875909d765cf8526bbdef2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 10 Apr 2022 06:45:27 +0800 Subject: vim-patch:8.2.4722: ending recording with mapping records too much (#18060) Problem: When a recording is ended with a mapped key that key is also recorded. Solution: Remember the previous last_recorded_len. (closes vim/vim#10122) https://github.com/vim/vim/commit/81b46a6ccd818609e1ca8cd410e26a58428c30ba --- src/nvim/testdir/test_registers.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index c623edd5a1..b852cfd22f 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -690,6 +690,27 @@ func Test_record_in_select_mode() bwipe! endfunc +" mapping that ends macro recording should be removed from recorded macro +func Test_end_record_using_mapping() + call setline(1, 'aaa') + nnoremap s q + call feedkeys('safas', 'tx') + call assert_equal('fa', @a) + nunmap s + + nnoremap xx q + call feedkeys('0xxafaxx', 'tx') + call assert_equal('fa', @a) + nunmap xx + + nnoremap xsx q + call feedkeys('0qafaxsx', 'tx') + call assert_equal('fa', @a) + nunmap xsx + + bwipe! +endfunc + func Test_end_reg_executing() nnoremap s let @a = 's' -- cgit