To: vim_dev@googlegroups.com
Subject: Patch 7.3.513
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.513
Problem:    Cannot use CTRL-E and CTRL-Y with "r".
Solution:   Make CTRL-E and CTRL-Y work like in Insert mode. (Christian
	    Brabandt)
Files:	    src/edit.c, src/normal.c, src/proto/edit.pro


*** ../vim-7.3.512/src/edit.c	2012-04-05 16:07:01.000000000 +0200
--- src/edit.c	2012-04-30 17:53:47.000000000 +0200
***************
*** 253,259 ****
  #ifdef FEAT_DIGRAPHS
  static int  ins_digraph __ARGS((void));
  #endif
- static int  ins_copychar __ARGS((linenr_T lnum));
  static int  ins_ctrl_ey __ARGS((int tc));
  #ifdef FEAT_SMARTINDENT
  static void ins_try_si __ARGS((int c));
--- 253,258 ----
***************
*** 9899,9905 ****
   * Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line.
   * Returns the char to be inserted, or NUL if none found.
   */
!     static int
  ins_copychar(lnum)
      linenr_T	lnum;
  {
--- 9898,9904 ----
   * Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line.
   * Returns the char to be inserted, or NUL if none found.
   */
!     int
  ins_copychar(lnum)
      linenr_T	lnum;
  {
*** ../vim-7.3.512/src/normal.c	2012-03-28 12:59:53.000000000 +0200
--- src/normal.c	2012-04-30 18:06:13.000000000 +0200
***************
*** 7070,7076 ****
  	    for (n = cap->count1; n > 0; --n)
  	    {
  		State = REPLACE;
! 		ins_char(cap->nchar);
  		State = old_State;
  		if (cap->ncharC1 != 0)
  		    ins_char(cap->ncharC1);
--- 7070,7087 ----
  	    for (n = cap->count1; n > 0; --n)
  	    {
  		State = REPLACE;
! 		if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
! 		{
! 		    int c = ins_copychar(curwin->w_cursor.lnum
! 					   + (cap->nchar == Ctrl_Y ? -1 : 1));
! 		    if (c != NUL)
! 			ins_char(c);
! 		    else
! 			/* will be decremented further down */
! 			++curwin->w_cursor.col;
! 		}
! 		else
! 		    ins_char(cap->nchar);
  		State = old_State;
  		if (cap->ncharC1 != 0)
  		    ins_char(cap->ncharC1);
***************
*** 7092,7098 ****
  		 * line will be changed.
  		 */
  		ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
! 		ptr[curwin->w_cursor.col] = cap->nchar;
  		if (p_sm && msg_silent == 0)
  		    showmatch(cap->nchar);
  		++curwin->w_cursor.col;
--- 7103,7117 ----
  		 * line will be changed.
  		 */
  		ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
! 		if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
! 		{
! 		  int c = ins_copychar(curwin->w_cursor.lnum
! 					   + (cap->nchar == Ctrl_Y ? -1 : 1));
! 		  if (c != NUL)
! 		    ptr[curwin->w_cursor.col] = c;
! 		}
! 		else
! 		    ptr[curwin->w_cursor.col] = cap->nchar;
  		if (p_sm && msg_silent == 0)
  		    showmatch(cap->nchar);
  		++curwin->w_cursor.col;
*** ../vim-7.3.512/src/proto/edit.pro	2010-08-15 21:57:28.000000000 +0200
--- src/proto/edit.pro	2012-04-30 17:54:41.000000000 +0200
***************
*** 39,42 ****
--- 39,43 ----
  int hkmap __ARGS((int c));
  void ins_scroll __ARGS((void));
  void ins_horscroll __ARGS((void));
+ int ins_copychar __ARGS((linenr_T lnum));
  /* vim: set ft=c : */
*** ../vim-7.3.512/src/version.c	2012-04-30 17:35:44.000000000 +0200
--- src/version.c	2012-04-30 18:17:52.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     513,
  /**/

-- 
It is illegal for anyone to try and stop a child from playfully jumping over
puddles of water.
		[real standing law in California, United States of America]

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///
