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