Patch 8.2.4722
Problem: When a recording is ended with a mapped key that key is also
recorded.
Solution: Remember the previous last_recorded_len. (closes #10122)
Files: src/getchar.c, src/testdir/test_registers.vim
*** ../vim-8.2.4721/src/getchar.c 2022-04-07 13:58:00.923085110 +0100
--- src/getchar.c 2022-04-09 17:45:37.373774799 +0100
***************
*** 1705,1714 ****
}
else
{
mod_mask = 0;
vgetc_mod_mask = 0;
vgetc_char = 0;
! last_recorded_len = 0;
for (;;) // this is done twice if there are modifiers
{
--- 1705,1720 ----
}
else
{
+ // number of characters recorded from the last vgetc() call
+ static int last_vgetc_recorded_len = 0;
+
mod_mask = 0;
vgetc_mod_mask = 0;
vgetc_char = 0;
!
! // last_recorded_len can be larger than last_vgetc_recorded_len
! // if peeking records more
! last_recorded_len -= last_vgetc_recorded_len;
for (;;) // this is done twice if there are modifiers
{
***************
*** 1910,1915 ****
--- 1916,1923 ----
break;
}
+
+ last_vgetc_recorded_len = last_recorded_len;
}
#ifdef FEAT_EVAL
*** ../vim-8.2.4721/src/testdir/test_registers.vim 2022-04-07
13:58:00.923085110 +0100
--- src/testdir/test_registers.vim 2022-04-09 17:57:50.121721564 +0100
***************
*** 759,764 ****
--- 759,785 ----
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 <Nop>
let @a = 's'
*** ../vim-8.2.4721/src/version.c 2022-04-09 16:08:04.951820681 +0100
--- src/version.c 2022-04-09 17:47:55.673840708 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4722,
/**/
--
SOLDIER: Where did you get the coconuts?
ARTHUR: Through ... We found them.
SOLDIER: Found them? In Mercea. The coconut's tropical!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220409171837.5FE1F1C0917%40moolenaar.net.