astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
dfc071b
To: vim_dev@googlegroups.com
dfc071b
Subject: Patch 7.4.743
dfc071b
Fcc: outbox
dfc071b
From: Bram Moolenaar <Bram@moolenaar.net>
dfc071b
Mime-Version: 1.0
dfc071b
Content-Type: text/plain; charset=UTF-8
dfc071b
Content-Transfer-Encoding: 8bit
dfc071b
------------
dfc071b
dfc071b
Patch 7.4.743
dfc071b
Problem:    "p" in Visual mode causes an unexpected line split.
dfc071b
Solution:   Advance the cursor first. (Yukihiro Nakadaira)
dfc071b
Files:      src/ops.c, src/testdir/test94.in, src/testdir/test94.ok
dfc071b
dfc071b
dfc071b
*** ../vim-7.4.742/src/ops.c	2015-06-09 20:19:57.730732183 +0200
dfc071b
--- src/ops.c	2015-06-19 14:50:19.344413102 +0200
dfc071b
***************
dfc071b
*** 3459,3475 ****
dfc071b
      {
dfc071b
  	if (flags & PUT_LINE_SPLIT)
dfc071b
  	{
dfc071b
  	    /* "p" or "P" in Visual mode: split the lines to put the text in
dfc071b
  	     * between. */
dfc071b
  	    if (u_save_cursor() == FAIL)
dfc071b
  		goto end;
dfc071b
! 	    ptr = vim_strsave(ml_get_cursor());
dfc071b
  	    if (ptr == NULL)
dfc071b
  		goto end;
dfc071b
  	    ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE);
dfc071b
  	    vim_free(ptr);
dfc071b
  
dfc071b
! 	    ptr = vim_strnsave(ml_get_curline(), curwin->w_cursor.col);
dfc071b
  	    if (ptr == NULL)
dfc071b
  		goto end;
dfc071b
  	    ml_replace(curwin->w_cursor.lnum, ptr, FALSE);
dfc071b
--- 3459,3484 ----
dfc071b
      {
dfc071b
  	if (flags & PUT_LINE_SPLIT)
dfc071b
  	{
dfc071b
+ 	    char_u *p;
dfc071b
+ 
dfc071b
  	    /* "p" or "P" in Visual mode: split the lines to put the text in
dfc071b
  	     * between. */
dfc071b
  	    if (u_save_cursor() == FAIL)
dfc071b
  		goto end;
dfc071b
! 	    p = ml_get_cursor();
dfc071b
! 	    if (dir == FORWARD && *p != NUL)
dfc071b
! 		mb_ptr_adv(p);
dfc071b
! 	    ptr = vim_strsave(p);
dfc071b
  	    if (ptr == NULL)
dfc071b
  		goto end;
dfc071b
  	    ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE);
dfc071b
  	    vim_free(ptr);
dfc071b
  
dfc071b
! 	    oldp = ml_get_curline();
dfc071b
! 	    p = oldp + curwin->w_cursor.col;
dfc071b
! 	    if (dir == FORWARD && *p != NUL)
dfc071b
! 		mb_ptr_adv(p);
dfc071b
! 	    ptr = vim_strnsave(oldp, p - oldp);
dfc071b
  	    if (ptr == NULL)
dfc071b
  		goto end;
dfc071b
  	    ml_replace(curwin->w_cursor.lnum, ptr, FALSE);
dfc071b
*** ../vim-7.4.742/src/testdir/test94.in	2015-06-09 20:19:57.730732183 +0200
dfc071b
--- src/testdir/test94.in	2015-06-19 14:49:22.357010930 +0200
dfc071b
***************
dfc071b
*** 174,179 ****
dfc071b
--- 174,215 ----
dfc071b
  :$put ='c'
dfc071b
  kgH<Down>
dfc071b
  :$put ='---'
dfc071b
+ :
dfc071b
+ :$put =''
dfc071b
+ :$put ='v_p: replace last character with line register at middle line'
dfc071b
+ :$put ='aaa'
dfc071b
+ :$put ='bbb'
dfc071b
+ :$put ='ccc'
dfc071b
+ :-2yank
dfc071b
+ k$vp
dfc071b
+ :$put ='---'
dfc071b
+ :
dfc071b
+ :$put =''
dfc071b
+ :$put ='v_p: replace last character with line register at middle line selecting newline'
dfc071b
+ :$put ='aaa'
dfc071b
+ :$put ='bbb'
dfc071b
+ :$put ='ccc'
dfc071b
+ :-2yank
dfc071b
+ k$v$p
dfc071b
+ :$put ='---'
dfc071b
+ :
dfc071b
+ :$put =''
dfc071b
+ :$put ='v_p: replace last character with line register at last line'
dfc071b
+ :$put ='aaa'
dfc071b
+ :$put ='bbb'
dfc071b
+ :$put ='ccc'
dfc071b
+ :-2yank
dfc071b
+ $vp
dfc071b
+ :$put ='---'
dfc071b
+ :
dfc071b
+ :$put =''
dfc071b
+ :$put ='v_p: replace last character with line register at last line selecting newline'
dfc071b
+ :$put ='aaa'
dfc071b
+ :$put ='bbb'
dfc071b
+ :$put ='ccc'
dfc071b
+ :-2yank
dfc071b
+ $v$p
dfc071b
+ :$put ='---'
dfc071b
  :/^start:/+2,$w! test.out
dfc071b
  :q!
dfc071b
  ENDTEST
dfc071b
*** ../vim-7.4.742/src/testdir/test94.ok	2015-06-09 20:19:57.730732183 +0200
dfc071b
--- src/testdir/test94.ok	2015-06-19 14:49:57.564641577 +0200
dfc071b
***************
dfc071b
*** 81,83 ****
dfc071b
--- 81,114 ----
dfc071b
  linewise select mode: delete last two line
dfc071b
  a
dfc071b
  ---
dfc071b
+ 
dfc071b
+ v_p: replace last character with line register at middle line
dfc071b
+ aaa
dfc071b
+ bb
dfc071b
+ aaa
dfc071b
+ 
dfc071b
+ ccc
dfc071b
+ ---
dfc071b
+ 
dfc071b
+ v_p: replace last character with line register at middle line selecting newline
dfc071b
+ aaa
dfc071b
+ bb
dfc071b
+ aaa
dfc071b
+ ccc
dfc071b
+ ---
dfc071b
+ 
dfc071b
+ v_p: replace last character with line register at last line
dfc071b
+ aaa
dfc071b
+ bbb
dfc071b
+ cc
dfc071b
+ aaa
dfc071b
+ 
dfc071b
+ ---
dfc071b
+ 
dfc071b
+ v_p: replace last character with line register at last line selecting newline
dfc071b
+ aaa
dfc071b
+ bbb
dfc071b
+ cc
dfc071b
+ aaa
dfc071b
+ 
dfc071b
+ ---
dfc071b
*** ../vim-7.4.742/src/version.c	2015-06-19 14:41:44.777813290 +0200
dfc071b
--- src/version.c	2015-06-19 14:45:13.251624852 +0200
dfc071b
***************
dfc071b
*** 743,744 ****
dfc071b
--- 743,746 ----
dfc071b
  {   /* Add new patch number below this line */
dfc071b
+ /**/
dfc071b
+     743,
dfc071b
  /**/
dfc071b
dfc071b
-- 
dfc071b
hundred-and-one symptoms of being an internet addict:
dfc071b
117. You are more comfortable typing in html.
dfc071b
dfc071b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
dfc071b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
dfc071b
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
dfc071b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///