Karsten Hopp 94ae6b
To: vim_dev@googlegroups.com
Karsten Hopp 94ae6b
Subject: Patch 7.4.269
Karsten Hopp 94ae6b
Fcc: outbox
Karsten Hopp 94ae6b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 94ae6b
Mime-Version: 1.0
Karsten Hopp 94ae6b
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 94ae6b
Content-Transfer-Encoding: 8bit
Karsten Hopp 94ae6b
------------
Karsten Hopp 94ae6b
Karsten Hopp 94ae6b
Patch 7.4.269
Karsten Hopp 94ae6b
Problem:    CTRL-U in Insert mode does not work after using a cursor key.
Karsten Hopp 94ae6b
	    (Pine Wu)
Karsten Hopp 94ae6b
Solution:   Use the original insert start position. (Christian Brabandt)
Karsten Hopp 94ae6b
Files:	    src/edit.c, src/testdir/test29.in, src/testdir/test29.ok
Karsten Hopp 94ae6b
Karsten Hopp 94ae6b
Karsten Hopp 94ae6b
*** ../vim-7.4.268/src/edit.c	2014-04-29 12:15:22.852032651 +0200
Karsten Hopp 94ae6b
--- src/edit.c	2014-04-29 14:44:07.867876234 +0200
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 8760,8767 ****
Karsten Hopp 94ae6b
  		((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0)
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_START)
Karsten Hopp 94ae6b
  			&& (arrow_used
Karsten Hopp 94ae6b
! 			    || (curwin->w_cursor.lnum == Insstart.lnum
Karsten Hopp 94ae6b
! 				&& curwin->w_cursor.col <= Insstart.col)))
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0
Karsten Hopp 94ae6b
  					 && curwin->w_cursor.col <= ai_col)
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_EOL) && curwin->w_cursor.col == 0))))
Karsten Hopp 94ae6b
--- 8760,8767 ----
Karsten Hopp 94ae6b
  		((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0)
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_START)
Karsten Hopp 94ae6b
  			&& (arrow_used
Karsten Hopp 94ae6b
! 			    || (curwin->w_cursor.lnum == Insstart_orig.lnum
Karsten Hopp 94ae6b
! 				&& curwin->w_cursor.col <= Insstart_orig.col)))
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0
Karsten Hopp 94ae6b
  					 && curwin->w_cursor.col <= ai_col)
Karsten Hopp 94ae6b
  		    || (!can_bs(BS_EOL) && curwin->w_cursor.col == 0))))
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 8812,8819 ****
Karsten Hopp 94ae6b
       */
Karsten Hopp 94ae6b
      if (curwin->w_cursor.col == 0)
Karsten Hopp 94ae6b
      {
Karsten Hopp 94ae6b
! 	lnum = Insstart.lnum;
Karsten Hopp 94ae6b
! 	if (curwin->w_cursor.lnum == Insstart.lnum
Karsten Hopp 94ae6b
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 94ae6b
  			|| revins_on
Karsten Hopp 94ae6b
  #endif
Karsten Hopp 94ae6b
--- 8812,8819 ----
Karsten Hopp 94ae6b
       */
Karsten Hopp 94ae6b
      if (curwin->w_cursor.col == 0)
Karsten Hopp 94ae6b
      {
Karsten Hopp 94ae6b
! 	lnum = Insstart_orig.lnum;
Karsten Hopp 94ae6b
! 	if (curwin->w_cursor.lnum == lnum
Karsten Hopp 94ae6b
  #ifdef FEAT_RIGHTLEFT
Karsten Hopp 94ae6b
  			|| revins_on
Karsten Hopp 94ae6b
  #endif
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 8822,8829 ****
Karsten Hopp 94ae6b
  	    if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
Karsten Hopp 94ae6b
  			       (linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL)
Karsten Hopp 94ae6b
  		return FALSE;
Karsten Hopp 94ae6b
! 	    --Insstart.lnum;
Karsten Hopp 94ae6b
! 	    Insstart.col = MAXCOL;
Karsten Hopp 94ae6b
  	}
Karsten Hopp 94ae6b
  	/*
Karsten Hopp 94ae6b
  	 * In replace mode:
Karsten Hopp 94ae6b
--- 8822,8829 ----
Karsten Hopp 94ae6b
  	    if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
Karsten Hopp 94ae6b
  			       (linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL)
Karsten Hopp 94ae6b
  		return FALSE;
Karsten Hopp 94ae6b
! 	    --Insstart_orig.lnum;
Karsten Hopp 94ae6b
! 	    Insstart_orig.col = MAXCOL;
Karsten Hopp 94ae6b
  	}
Karsten Hopp 94ae6b
  	/*
Karsten Hopp 94ae6b
  	 * In replace mode:
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 8981,8989 ****
Karsten Hopp 94ae6b
  	    while (vcol < want_vcol)
Karsten Hopp 94ae6b
  	    {
Karsten Hopp 94ae6b
  		/* Remember the first char we inserted */
Karsten Hopp 94ae6b
! 		if (curwin->w_cursor.lnum == Insstart.lnum
Karsten Hopp 94ae6b
! 				   && curwin->w_cursor.col < Insstart.col)
Karsten Hopp 94ae6b
! 		    Insstart.col = curwin->w_cursor.col;
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
  #ifdef FEAT_VREPLACE
Karsten Hopp 94ae6b
  		if (State & VREPLACE_FLAG)
Karsten Hopp 94ae6b
--- 8981,8989 ----
Karsten Hopp 94ae6b
  	    while (vcol < want_vcol)
Karsten Hopp 94ae6b
  	    {
Karsten Hopp 94ae6b
  		/* Remember the first char we inserted */
Karsten Hopp 94ae6b
! 		if (curwin->w_cursor.lnum == Insstart_orig.lnum
Karsten Hopp 94ae6b
! 				   && curwin->w_cursor.col < Insstart_orig.col)
Karsten Hopp 94ae6b
! 		    Insstart_orig.col = curwin->w_cursor.col;
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
  #ifdef FEAT_VREPLACE
Karsten Hopp 94ae6b
  		if (State & VREPLACE_FLAG)
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 9071,9078 ****
Karsten Hopp 94ae6b
  		revins_on ||
Karsten Hopp 94ae6b
  #endif
Karsten Hopp 94ae6b
  		(curwin->w_cursor.col > mincol
Karsten Hopp 94ae6b
! 		 && (curwin->w_cursor.lnum != Insstart.lnum
Karsten Hopp 94ae6b
! 		     || curwin->w_cursor.col != Insstart.col)));
Karsten Hopp 94ae6b
  	did_backspace = TRUE;
Karsten Hopp 94ae6b
      }
Karsten Hopp 94ae6b
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 94ae6b
--- 9071,9078 ----
Karsten Hopp 94ae6b
  		revins_on ||
Karsten Hopp 94ae6b
  #endif
Karsten Hopp 94ae6b
  		(curwin->w_cursor.col > mincol
Karsten Hopp 94ae6b
! 		 && (curwin->w_cursor.lnum != Insstart_orig.lnum
Karsten Hopp 94ae6b
! 		     || curwin->w_cursor.col != Insstart_orig.col)));
Karsten Hopp 94ae6b
  	did_backspace = TRUE;
Karsten Hopp 94ae6b
      }
Karsten Hopp 94ae6b
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 9090,9098 ****
Karsten Hopp 94ae6b
      AppendCharToRedobuff(c);
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
      /* If deleted before the insertion point, adjust it */
Karsten Hopp 94ae6b
!     if (curwin->w_cursor.lnum == Insstart.lnum
Karsten Hopp 94ae6b
! 				       && curwin->w_cursor.col < Insstart.col)
Karsten Hopp 94ae6b
! 	Insstart.col = curwin->w_cursor.col;
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
      /* vi behaviour: the cursor moves backward but the character that
Karsten Hopp 94ae6b
       *		     was there remains visible
Karsten Hopp 94ae6b
--- 9090,9098 ----
Karsten Hopp 94ae6b
      AppendCharToRedobuff(c);
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
      /* If deleted before the insertion point, adjust it */
Karsten Hopp 94ae6b
!     if (curwin->w_cursor.lnum == Insstart_orig.lnum
Karsten Hopp 94ae6b
! 				       && curwin->w_cursor.col < Insstart_orig.col)
Karsten Hopp 94ae6b
! 	Insstart_orig.col = curwin->w_cursor.col;
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
      /* vi behaviour: the cursor moves backward but the character that
Karsten Hopp 94ae6b
       *		     was there remains visible
Karsten Hopp 94ae6b
*** ../vim-7.4.268/src/testdir/test29.in	2012-06-13 13:48:26.000000000 +0200
Karsten Hopp 94ae6b
--- src/testdir/test29.in	2014-04-29 14:31:23.619889628 +0200
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 102,107 ****
Karsten Hopp 94ae6b
--- 102,135 ----
Karsten Hopp 94ae6b
  }
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
  STARTTEST
Karsten Hopp 94ae6b
+ :" Test with backspace set to the non-compatible setting
Karsten Hopp 94ae6b
+ /^\d\+ this
Karsten Hopp 94ae6b
+ :set cp bs=2
Karsten Hopp 94ae6b
+ Avim1??
Karsten Hopp 94ae6b
+ Avim2?u??
Karsten Hopp 94ae6b
+ :set cpo-=<
Karsten Hopp 94ae6b
+ :inoremap <c-u> <left><c-u>
Karsten Hopp 94ae6b
+ Avim3??
Karsten Hopp 94ae6b
+ :iunmap <c-u>
Karsten Hopp 94ae6b
+ Avim4???
Karsten Hopp 94ae6b
+ :" Test with backspace set to the compatible setting
Karsten Hopp 94ae6b
+ :set bs=
Karsten Hopp 94ae6b
+ A vim5?A???
Karsten Hopp 94ae6b
+ A vim6?Azwei?u??
Karsten Hopp 94ae6b
+ :inoremap <c-u> <left><c-u>
Karsten Hopp 94ae6b
+ A vim7???
Karsten Hopp 94ae6b
+ :set cp
Karsten Hopp 94ae6b
+ ENDTEST
Karsten Hopp 94ae6b
+ 1 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 2 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 3 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 4 this should be deleted
Karsten Hopp 94ae6b
+ 5 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 6 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 7 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 8 this shouldn't be deleted (not touched yet)
Karsten Hopp 94ae6b
+ 
Karsten Hopp 94ae6b
+ STARTTEST
Karsten Hopp 94ae6b
  /^{/+1
Karsten Hopp 94ae6b
  :set comments=sO:*\ -,mO:*\ \ ,exO:*/
Karsten Hopp 94ae6b
  :set comments+=s1:/*,mb:*,ex:*/,://
Karsten Hopp 94ae6b
*** ../vim-7.4.268/src/testdir/test29.ok	2012-06-13 13:48:26.000000000 +0200
Karsten Hopp 94ae6b
--- src/testdir/test29.ok	2014-04-29 14:31:23.623889628 +0200
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 62,67 ****
Karsten Hopp 94ae6b
--- 62,76 ----
Karsten Hopp 94ae6b
      action();
Karsten Hopp 94ae6b
  }
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
+ 1 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 2 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 3 this shouldn't be deleted
Karsten Hopp 94ae6b
+ 4 this should be deleted3
Karsten Hopp 94ae6b
+ 
Karsten Hopp 94ae6b
+ 6 this shouldn't be deleted vim5
Karsten Hopp 94ae6b
+ 7 this shouldn't be deleted vim6
Karsten Hopp 94ae6b
+ 8 this shouldn't be deleted (not touched yet) vim7
Karsten Hopp 94ae6b
+ 
Karsten Hopp 94ae6b
  
Karsten Hopp 94ae6b
  {
Karsten Hopp 94ae6b
  /* Make sure the previous comment leader is not removed.  */
Karsten Hopp 94ae6b
*** ../vim-7.4.268/src/version.c	2014-04-29 14:02:42.547919791 +0200
Karsten Hopp 94ae6b
--- src/version.c	2014-04-29 14:42:09.083878315 +0200
Karsten Hopp 94ae6b
***************
Karsten Hopp 94ae6b
*** 736,737 ****
Karsten Hopp 94ae6b
--- 736,739 ----
Karsten Hopp 94ae6b
  {   /* Add new patch number below this line */
Karsten Hopp 94ae6b
+ /**/
Karsten Hopp 94ae6b
+     269,
Karsten Hopp 94ae6b
  /**/
Karsten Hopp 94ae6b
Karsten Hopp 94ae6b
-- 
Karsten Hopp 94ae6b
From "know your smileys":
Karsten Hopp 94ae6b
 [:-)	Frankenstein's monster
Karsten Hopp 94ae6b
Karsten Hopp 94ae6b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 94ae6b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 94ae6b
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 94ae6b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///