Karsten Hopp b46620
To: vim_dev@googlegroups.com
Karsten Hopp b46620
Subject: Patch 7.3.513
Karsten Hopp b46620
Fcc: outbox
Karsten Hopp b46620
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp b46620
Mime-Version: 1.0
Karsten Hopp b46620
Content-Type: text/plain; charset=UTF-8
Karsten Hopp b46620
Content-Transfer-Encoding: 8bit
Karsten Hopp b46620
------------
Karsten Hopp b46620
Karsten Hopp b46620
Patch 7.3.513
Karsten Hopp b46620
Problem:    Cannot use CTRL-E and CTRL-Y with "r".
Karsten Hopp b46620
Solution:   Make CTRL-E and CTRL-Y work like in Insert mode. (Christian
Karsten Hopp b46620
	    Brabandt)
Karsten Hopp b46620
Files:	    src/edit.c, src/normal.c, src/proto/edit.pro
Karsten Hopp b46620
Karsten Hopp b46620
Karsten Hopp b46620
*** ../vim-7.3.512/src/edit.c	2012-04-05 16:07:01.000000000 +0200
Karsten Hopp b46620
--- src/edit.c	2012-04-30 17:53:47.000000000 +0200
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 253,259 ****
Karsten Hopp b46620
  #ifdef FEAT_DIGRAPHS
Karsten Hopp b46620
  static int  ins_digraph __ARGS((void));
Karsten Hopp b46620
  #endif
Karsten Hopp b46620
- static int  ins_copychar __ARGS((linenr_T lnum));
Karsten Hopp b46620
  static int  ins_ctrl_ey __ARGS((int tc));
Karsten Hopp b46620
  #ifdef FEAT_SMARTINDENT
Karsten Hopp b46620
  static void ins_try_si __ARGS((int c));
Karsten Hopp b46620
--- 253,258 ----
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 9899,9905 ****
Karsten Hopp b46620
   * Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line.
Karsten Hopp b46620
   * Returns the char to be inserted, or NUL if none found.
Karsten Hopp b46620
   */
Karsten Hopp b46620
!     static int
Karsten Hopp b46620
  ins_copychar(lnum)
Karsten Hopp b46620
      linenr_T	lnum;
Karsten Hopp b46620
  {
Karsten Hopp b46620
--- 9898,9904 ----
Karsten Hopp b46620
   * Handle CTRL-E and CTRL-Y in Insert mode: copy char from other line.
Karsten Hopp b46620
   * Returns the char to be inserted, or NUL if none found.
Karsten Hopp b46620
   */
Karsten Hopp b46620
!     int
Karsten Hopp b46620
  ins_copychar(lnum)
Karsten Hopp b46620
      linenr_T	lnum;
Karsten Hopp b46620
  {
Karsten Hopp b46620
*** ../vim-7.3.512/src/normal.c	2012-03-28 12:59:53.000000000 +0200
Karsten Hopp b46620
--- src/normal.c	2012-04-30 18:06:13.000000000 +0200
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 7070,7076 ****
Karsten Hopp b46620
  	    for (n = cap->count1; n > 0; --n)
Karsten Hopp b46620
  	    {
Karsten Hopp b46620
  		State = REPLACE;
Karsten Hopp b46620
! 		ins_char(cap->nchar);
Karsten Hopp b46620
  		State = old_State;
Karsten Hopp b46620
  		if (cap->ncharC1 != 0)
Karsten Hopp b46620
  		    ins_char(cap->ncharC1);
Karsten Hopp b46620
--- 7070,7087 ----
Karsten Hopp b46620
  	    for (n = cap->count1; n > 0; --n)
Karsten Hopp b46620
  	    {
Karsten Hopp b46620
  		State = REPLACE;
Karsten Hopp b46620
! 		if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
Karsten Hopp b46620
! 		{
Karsten Hopp b46620
! 		    int c = ins_copychar(curwin->w_cursor.lnum
Karsten Hopp b46620
! 					   + (cap->nchar == Ctrl_Y ? -1 : 1));
Karsten Hopp b46620
! 		    if (c != NUL)
Karsten Hopp b46620
! 			ins_char(c);
Karsten Hopp b46620
! 		    else
Karsten Hopp b46620
! 			/* will be decremented further down */
Karsten Hopp b46620
! 			++curwin->w_cursor.col;
Karsten Hopp b46620
! 		}
Karsten Hopp b46620
! 		else
Karsten Hopp b46620
! 		    ins_char(cap->nchar);
Karsten Hopp b46620
  		State = old_State;
Karsten Hopp b46620
  		if (cap->ncharC1 != 0)
Karsten Hopp b46620
  		    ins_char(cap->ncharC1);
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 7092,7098 ****
Karsten Hopp b46620
  		 * line will be changed.
Karsten Hopp b46620
  		 */
Karsten Hopp b46620
  		ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
Karsten Hopp b46620
! 		ptr[curwin->w_cursor.col] = cap->nchar;
Karsten Hopp b46620
  		if (p_sm && msg_silent == 0)
Karsten Hopp b46620
  		    showmatch(cap->nchar);
Karsten Hopp b46620
  		++curwin->w_cursor.col;
Karsten Hopp b46620
--- 7103,7117 ----
Karsten Hopp b46620
  		 * line will be changed.
Karsten Hopp b46620
  		 */
Karsten Hopp b46620
  		ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
Karsten Hopp b46620
! 		if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
Karsten Hopp b46620
! 		{
Karsten Hopp b46620
! 		  int c = ins_copychar(curwin->w_cursor.lnum
Karsten Hopp b46620
! 					   + (cap->nchar == Ctrl_Y ? -1 : 1));
Karsten Hopp b46620
! 		  if (c != NUL)
Karsten Hopp b46620
! 		    ptr[curwin->w_cursor.col] = c;
Karsten Hopp b46620
! 		}
Karsten Hopp b46620
! 		else
Karsten Hopp b46620
! 		    ptr[curwin->w_cursor.col] = cap->nchar;
Karsten Hopp b46620
  		if (p_sm && msg_silent == 0)
Karsten Hopp b46620
  		    showmatch(cap->nchar);
Karsten Hopp b46620
  		++curwin->w_cursor.col;
Karsten Hopp b46620
*** ../vim-7.3.512/src/proto/edit.pro	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp b46620
--- src/proto/edit.pro	2012-04-30 17:54:41.000000000 +0200
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 39,42 ****
Karsten Hopp b46620
--- 39,43 ----
Karsten Hopp b46620
  int hkmap __ARGS((int c));
Karsten Hopp b46620
  void ins_scroll __ARGS((void));
Karsten Hopp b46620
  void ins_horscroll __ARGS((void));
Karsten Hopp b46620
+ int ins_copychar __ARGS((linenr_T lnum));
Karsten Hopp b46620
  /* vim: set ft=c : */
Karsten Hopp b46620
*** ../vim-7.3.512/src/version.c	2012-04-30 17:35:44.000000000 +0200
Karsten Hopp b46620
--- src/version.c	2012-04-30 18:17:52.000000000 +0200
Karsten Hopp b46620
***************
Karsten Hopp b46620
*** 716,717 ****
Karsten Hopp b46620
--- 716,719 ----
Karsten Hopp b46620
  {   /* Add new patch number below this line */
Karsten Hopp b46620
+ /**/
Karsten Hopp b46620
+     513,
Karsten Hopp b46620
  /**/
Karsten Hopp b46620
Karsten Hopp b46620
-- 
Karsten Hopp b46620
It is illegal for anyone to try and stop a child from playfully jumping over
Karsten Hopp b46620
puddles of water.
Karsten Hopp b46620
		[real standing law in California, United States of America]
Karsten Hopp b46620
Karsten Hopp b46620
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp b46620
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp b46620
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp b46620
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///