Patch 8.1.2375
Problem:    No suffucient testing for registers.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes #5296)
            Fix that "p" on last virtual column of tab inserts spaces.
Files:      src/register.c, src/testdir/test_registers.vim,
            src/testdir/test_virtualedit.vim, src/testdir/test_visual.vim


*** ../vim-8.1.2374/src/register.c      2019-11-16 13:50:18.777646751 +0100
--- src/register.c      2019-12-01 18:13:55.926222243 +0100
***************
*** 1668,1688 ****
      {
        if (gchar_cursor() == TAB)
        {
            // Don't need to insert spaces when "p" on the last position of a
            // tab or "P" on the first position.
  #ifdef FEAT_VARTABS
!           int viscol = getviscol();
!           if (dir == FORWARD
!                   ? tabstop_padding(viscol, curbuf->b_p_ts,
!                                                   curbuf->b_p_vts_array) != 1
!                   : curwin->w_cursor.coladd > 0)
!               coladvance_force(viscol);
  #else
!           if (dir == FORWARD
!                   ? (int)curwin->w_cursor.coladd < curbuf->b_p_ts - 1
!                                               : curwin->w_cursor.coladd > 0)
!               coladvance_force(getviscol());
  #endif
            else
                curwin->w_cursor.coladd = 0;
        }
--- 1668,1686 ----
      {
        if (gchar_cursor() == TAB)
        {
+           int viscol = getviscol();
+           int ts = curbuf->b_p_ts;
+ 
            // Don't need to insert spaces when "p" on the last position of a
            // tab or "P" on the first position.
+           if (dir == FORWARD ?
  #ifdef FEAT_VARTABS
!                   tabstop_padding(viscol, ts, curbuf->b_p_vts_array) != 1
  #else
!                   ts - (viscol % ts) != 1
  #endif
+                   : curwin->w_cursor.coladd > 0)
+               coladvance_force(viscol);
            else
                curwin->w_cursor.coladd = 0;
        }
*** ../vim-8.1.2374/src/testdir/test_registers.vim      2019-11-30 
19:48:42.650673642 +0100
--- src/testdir/test_registers.vim      2019-12-01 18:10:02.891305242 +0100
***************
*** 10,15 ****
--- 10,17 ----
    call assert_fails('normal @!', 'E354:')
    call assert_fails('normal @:', 'E30:')
    call assert_fails('normal @.', 'E29:')
+   call assert_fails('put /', 'E35:')
+   call assert_fails('put .', 'E29:')
  endfunc
  
  func Test_yank_shows_register()
***************
*** 203,208 ****
--- 205,218 ----
    normal @@
    call assert_equal('EditEdit', a)
  
+   " Test for repeating the last command-line in visual mode
+   call append(0, 'register')
+   normal gg
+   let @r = ''
+   call feedkeys("v:yank R\<CR>", 'xt')
+   call feedkeys("v@:", 'xt')
+   call assert_equal("\nregister\nregister\n", @r)
+ 
    enew!
  endfunc
  
***************
*** 226,231 ****
--- 236,263 ----
  
    call assert_equal('', getregtype('!'))
  
+   " Test for clipboard registers (* and +)
+   if has("clipboard_working")
+     call append(0, "text for clipboard test")
+     normal gg"*yiw
+     call assert_equal('text', getreg('*'))
+     normal gg2w"+yiw
+     call assert_equal('clipboard', getreg('+'))
+   endif
+ 
+   " Test for inserting an invalid register content
+   call assert_beeps('exe "normal i\<C-R>!"')
+ 
+   " Test for inserting a register with multiple lines
+   call deletebufline('', 1, '$')
+   call setreg('r', ['a', 'b'])
+   exe "normal i\<C-R>r"
+   call assert_equal(['a', 'b', ''], getline(1, '$'))
+ 
+   " Test for inserting a multi-line register in the command line
+   call feedkeys(":\<C-R>r\<Esc>", 'xt')
+   call assert_equal("a\rb\r", histget(':', -1))
+ 
    enew!
  endfunc
  
***************
*** 249,254 ****
--- 281,305 ----
    call setreg('=', 'b', 'a')
    call assert_equal('regwrite', getreg('='))
  
+   " Test for settting a list of lines to special registers
+   call setreg('/', [])
+   call assert_equal('', @/)
+   call setreg('=', [])
+   call assert_equal('', @=)
+   call assert_fails("call setreg('/', ['a', 'b'])", 'E883:')
+   call assert_fails("call setreg('=', ['a', 'b'])", 'E883:')
+   call assert_equal(0, setreg('_', ['a', 'b']))
+ 
+   " Test for recording to a invalid register
+   call assert_beeps('normal q$')
+ 
+   " Appending to a register when recording
+   call append(0, "text for clipboard test")
+   normal gg
+   call feedkeys('qrllq', 'xt')
+   call feedkeys('qRhhq', 'xt')
+   call assert_equal('llhh', getreg('r'))
+ 
    enew!
  endfunc
  
*** ../vim-8.1.2374/src/testdir/test_virtualedit.vim    2019-10-31 
03:21:21.121403678 +0100
--- src/testdir/test_virtualedit.vim    2019-12-01 18:10:02.891305242 +0100
***************
*** 81,84 ****
--- 81,126 ----
    normal Cx
    call assert_equal('x', getline(1))
    bwipe!
+   set virtualedit=
+ endfunc
+ 
+ " Test for pasting before and after a tab character
+ func Test_paste_in_tab()
+   new
+   let @" = 'xyz'
+   set virtualedit=all
+   call append(0, "a\tb")
+   call cursor(1, 2, 6)
+   normal p
+   call assert_equal("a\txyzb", getline(1))
+   call setline(1, "a\tb")
+   call cursor(1, 2)
+   normal P
+   call assert_equal("axyz\tb", getline(1))
+ 
+   " Test for virtual block paste
+   call setreg('"', 'xyz', 'b')
+   call setline(1, "a\tb")
+   call cursor(1, 2, 6)
+   normal p
+   call assert_equal("a\txyzb", getline(1))
+   call setline(1, "a\tb")
+   call cursor(1, 2, 6)
+   normal P
+   call assert_equal("a      xyz b", getline(1))
+ 
+   " Test for virtual block paste with gp and gP
+   call setline(1, "a\tb")
+   call cursor(1, 2, 6)
+   normal gp
+   call assert_equal("a\txyzb", getline(1))
+   call assert_equal([0, 1, 6, 0, 12], getcurpos())
+   call setline(1, "a\tb")
+   call cursor(1, 2, 6)
+   normal gP
+   call assert_equal("a      xyz b", getline(1))
+   call assert_equal([0, 1, 12, 0 ,12], getcurpos())
+ 
+   bwipe!
+   set virtualedit=
  endfunc
*** ../vim-8.1.2374/src/testdir/test_visual.vim 2019-04-27 18:00:29.851064563 
+0200
--- src/testdir/test_visual.vim 2019-12-01 18:10:02.891305242 +0100
***************
*** 428,430 ****
--- 428,445 ----
  
    close!
  endfunc
+ 
+ " Test for 'p'ut in visual block mode
+ func Test_visual_block_put()
+   enew
+ 
+   call append(0, ['One', 'Two', 'Three'])
+   normal gg
+   yank
+   call feedkeys("jl\<C-V>ljp", 'xt')
+   call assert_equal(['One', 'T', 'Tee', 'One', ''], getline(1, '$'))
+ 
+   enew!
+ endfunc
+ 
+ " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.1.2374/src/version.c       2019-12-01 15:30:58.890215301 +0100
--- src/version.c       2019-12-01 18:11:39.894853204 +0100
***************
*** 744,745 ****
--- 744,747 ----
  {   /* Add new patch number below this line */
+ /**/
+     2375,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
167. You have more than 200 websites bookmarked.

 /// 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/201912011716.xB1HGs9a009026%40masaka.moolenaar.net.

Raspunde prin e-mail lui