Karsten Hopp d85d21
To: vim_dev@googlegroups.com
Karsten Hopp d85d21
Subject: Patch 7.4.199
Karsten Hopp d85d21
Fcc: outbox
Karsten Hopp d85d21
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d85d21
Mime-Version: 1.0
Karsten Hopp d85d21
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d85d21
Content-Transfer-Encoding: 8bit
Karsten Hopp d85d21
------------
Karsten Hopp d85d21
Karsten Hopp d85d21
Patch 7.4.199
Karsten Hopp d85d21
Problem:    (issue 197) ]P doesn't paste over Visual selection.
Karsten Hopp d85d21
Solution:   Handle Visual mode specifically. (Christian Brabandt)
Karsten Hopp d85d21
Files:	    src/normal.c
Karsten Hopp d85d21
Karsten Hopp d85d21
Karsten Hopp d85d21
*** ../vim-7.4.198/src/normal.c	2014-02-23 23:38:58.824760280 +0100
Karsten Hopp d85d21
--- src/normal.c	2014-03-12 17:33:28.184831049 +0100
Karsten Hopp d85d21
***************
Karsten Hopp d85d21
*** 6751,6760 ****
Karsten Hopp d85d21
      {
Karsten Hopp d85d21
  	if (!checkclearop(cap->oap))
Karsten Hopp d85d21
  	{
Karsten Hopp d85d21
  	    prep_redo_cmd(cap);
Karsten Hopp d85d21
! 	    do_put(cap->oap->regname,
Karsten Hopp d85d21
! 	      (cap->cmdchar == ']' && cap->nchar == 'p') ? FORWARD : BACKWARD,
Karsten Hopp d85d21
! 						  cap->count1, PUT_FIXINDENT);
Karsten Hopp d85d21
  	}
Karsten Hopp d85d21
      }
Karsten Hopp d85d21
  
Karsten Hopp d85d21
--- 6751,6808 ----
Karsten Hopp d85d21
      {
Karsten Hopp d85d21
  	if (!checkclearop(cap->oap))
Karsten Hopp d85d21
  	{
Karsten Hopp d85d21
+ 	    int	    dir = (cap->cmdchar == ']' && cap->nchar == 'p')
Karsten Hopp d85d21
+ 							 ? FORWARD : BACKWARD;
Karsten Hopp d85d21
+ 	    int	    regname = cap->oap->regname;
Karsten Hopp d85d21
+ #ifdef FEAT_VISUAL
Karsten Hopp d85d21
+ 	    int	    was_visual = VIsual_active;
Karsten Hopp d85d21
+ 	    int	    line_count = curbuf->b_ml.ml_line_count;
Karsten Hopp d85d21
+ 	    pos_T   start, end;
Karsten Hopp d85d21
+ 
Karsten Hopp d85d21
+ 	    if (VIsual_active)
Karsten Hopp d85d21
+ 	    {
Karsten Hopp d85d21
+ 		start = ltoreq(VIsual, curwin->w_cursor)
Karsten Hopp d85d21
+ 						  ? VIsual : curwin->w_cursor;
Karsten Hopp d85d21
+ 		end =  equalpos(start,VIsual) ? curwin->w_cursor : VIsual;
Karsten Hopp d85d21
+ 		curwin->w_cursor = (dir == BACKWARD ? start : end);
Karsten Hopp d85d21
+ 	    }
Karsten Hopp d85d21
+ #endif
Karsten Hopp d85d21
+ # ifdef FEAT_CLIPBOARD
Karsten Hopp d85d21
+ 	    adjust_clip_reg(&regname);
Karsten Hopp d85d21
+ # endif
Karsten Hopp d85d21
  	    prep_redo_cmd(cap);
Karsten Hopp d85d21
! 
Karsten Hopp d85d21
! 	    do_put(regname, dir, cap->count1, PUT_FIXINDENT);
Karsten Hopp d85d21
! #ifdef FEAT_VISUAL
Karsten Hopp d85d21
! 	    if (was_visual)
Karsten Hopp d85d21
! 	    {
Karsten Hopp d85d21
! 		VIsual = start;
Karsten Hopp d85d21
! 		curwin->w_cursor = end;
Karsten Hopp d85d21
! 		if (dir == BACKWARD)
Karsten Hopp d85d21
! 		{
Karsten Hopp d85d21
! 		    /* adjust lines */
Karsten Hopp d85d21
! 		    VIsual.lnum += curbuf->b_ml.ml_line_count - line_count;
Karsten Hopp d85d21
! 		    curwin->w_cursor.lnum +=
Karsten Hopp d85d21
! 				      curbuf->b_ml.ml_line_count - line_count;
Karsten Hopp d85d21
! 		}
Karsten Hopp d85d21
! 
Karsten Hopp d85d21
! 		VIsual_active = TRUE;
Karsten Hopp d85d21
! 		if (VIsual_mode == 'V')
Karsten Hopp d85d21
! 		{
Karsten Hopp d85d21
! 		    /* delete visually selected lines */
Karsten Hopp d85d21
! 		    cap->cmdchar = 'd';
Karsten Hopp d85d21
! 		    cap->nchar = NUL;
Karsten Hopp d85d21
! 		    cap->oap->regname = regname;
Karsten Hopp d85d21
! 		    nv_operator(cap);
Karsten Hopp d85d21
! 		    do_pending_operator(cap, 0, FALSE);
Karsten Hopp d85d21
! 		}
Karsten Hopp d85d21
! 		if (VIsual_active)
Karsten Hopp d85d21
! 		{
Karsten Hopp d85d21
! 		    end_visual_mode();
Karsten Hopp d85d21
! 		    redraw_later(SOME_VALID);
Karsten Hopp d85d21
! 		}
Karsten Hopp d85d21
! 	    }
Karsten Hopp d85d21
! #endif
Karsten Hopp d85d21
  	}
Karsten Hopp d85d21
      }
Karsten Hopp d85d21
  
Karsten Hopp d85d21
*** ../vim-7.4.198/src/version.c	2014-03-12 17:08:01.508807656 +0100
Karsten Hopp d85d21
--- src/version.c	2014-03-12 17:30:36.908828425 +0100
Karsten Hopp d85d21
***************
Karsten Hopp d85d21
*** 740,741 ****
Karsten Hopp d85d21
--- 740,743 ----
Karsten Hopp d85d21
  {   /* Add new patch number below this line */
Karsten Hopp d85d21
+ /**/
Karsten Hopp d85d21
+     199,
Karsten Hopp d85d21
  /**/
Karsten Hopp d85d21
Karsten Hopp d85d21
-- 
Karsten Hopp d85d21
No man may purchase alcohol without written consent from his wife.
Karsten Hopp d85d21
		[real standing law in Pennsylvania, United States of America]
Karsten Hopp d85d21
Karsten Hopp d85d21
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d85d21
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d85d21
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d85d21
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///