Patch 8.2.0929
Problem:    v:register is not cleared after an operator was executed.
Solution:   Clear v:register after finishing an operator (Andy Massimino,
            closes #5305)
Files:      src/normal.c, src/testdir/test_registers.vim


*** ../vim-8.2.0928/src/normal.c        2020-06-06 15:57:59.087088319 +0200
--- src/normal.c        2020-06-07 21:25:59.167336047 +0200
***************
*** 1181,1186 ****
--- 1181,1191 ----
  
      msg_nowait = FALSE;
  
+ #ifdef FEAT_EVAL
+     if (finish_op)
+       reset_reg_var();
+ #endif
+ 
      // Reset finish_op, in case it was set
  #ifdef CURSOR_SHAPE
      c = finish_op;
*** ../vim-8.2.0928/src/testdir/test_registers.vim      2020-06-07 
18:16:31.311293288 +0200
--- src/testdir/test_registers.vim      2020-06-07 21:27:46.871021206 +0200
***************
*** 488,491 ****
--- 488,560 ----
    bwipe!
  endfunc
  
+ func Test_v_register()
+   enew
+   call setline(1, 'nothing')
+ 
+   func s:Put()
+     let s:register = v:register
+     exec 'normal! "' .. v:register .. 'P'
+   endfunc
+   nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
+   nmap <buffer> S <plug>(test)
+ 
+   let @z = "testz\n"
+   let @" = "test@\n"
+ 
+   let s:register = ''
+   call feedkeys('"_ddS', 'mx')
+   call assert_equal('test@', getline('.'))  " fails before 8.2.0929
+   call assert_equal('"', s:register)        " fails before 8.2.0929
+ 
+   let s:register = ''
+   call feedkeys('"zS', 'mx')
+   call assert_equal('z', s:register)
+ 
+   let s:register = ''
+   call feedkeys('"zSS', 'mx')
+   call assert_equal('"', s:register)
+ 
+   let s:register = ''
+   call feedkeys('"_S', 'mx')
+   call assert_equal('_', s:register)
+ 
+   let s:register = ''
+   normal "_ddS
+   call assert_equal('"', s:register)        " fails before 8.2.0929
+   call assert_equal('test@', getline('.'))  " fails before 8.2.0929
+ 
+   let s:register = ''
+   execute 'normal "z:call' "s:Put()\n"
+   call assert_equal('z', s:register)
+   call assert_equal('testz', getline('.'))
+ 
+   " Test operator and omap
+   let @b = 'testb'
+   func s:OpFunc(...)
+     let s:register2 = v:register
+   endfunc
+   set opfunc=s:OpFunc
+ 
+   normal "bg@l
+   normal S
+   call assert_equal('"', s:register)        " fails before 8.2.0929
+   call assert_equal('b', s:register2)
+ 
+   func s:Motion()
+     let s:register1 = v:register
+     normal! l
+   endfunc
+   onoremap <buffer> Q :<c-u>call s:Motion()<cr>
+ 
+   normal "bg@Q
+   normal S
+   call assert_equal('"', s:register)
+   call assert_equal('b', s:register1)
+   call assert_equal('"', s:register2)
+ 
+   set opfunc&
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.0928/src/version.c       2020-06-07 20:49:02.077891881 +0200
--- src/version.c       2020-06-07 21:24:25.323607528 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     929,
  /**/

-- 
   An extraordinary TALL KNIGHT in all black (possibly John with Mike on his
   shoulders) walks out from the dark trees.  He is extremely fierce and
   gruesome countenance.  He walks towards KING ARTHUR and PATSY, who are
   wazzing like mad.  (Salopian slang, meaning very scared.  almost to the
   point of wetting oneself, e.g. before an important football match or
   prior to a postering.  Salopian slang meaning a beating by the school
   praeposters.  Sorry about the Salopian slant to this stage direction - Ed.)
                 "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/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202006071931.057JVhqV128874%40masaka.moolenaar.net.

Raspunde prin e-mail lui