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