39d3d53
To: vim_dev@googlegroups.com
39d3d53
Subject: Patch 7.3.395
39d3d53
Fcc: outbox
39d3d53
From: Bram Moolenaar <Bram@moolenaar.net>
39d3d53
Mime-Version: 1.0
39d3d53
Content-Type: text/plain; charset=UTF-8
39d3d53
Content-Transfer-Encoding: 8bit
39d3d53
------------
39d3d53
39d3d53
Patch 7.3.395 (after 7.3.251)
39d3d53
Problem:    "dv?bar" in the last line deletes too much and breaks undo.
39d3d53
Solution:   Only adjust the cursor position when it's after the last line of
39d3d53
	    the buffer.  Add a test. (Christian Brabandt)
39d3d53
Files:	    src/ops.c, src/testdir/test43.in, src/testdir/test43.ok
39d3d53
39d3d53
39d3d53
*** ../vim-7.3.394/src/ops.c	2011-09-21 17:33:49.000000000 +0200
39d3d53
--- src/ops.c	2012-01-10 13:28:05.000000000 +0100
39d3d53
***************
39d3d53
*** 1961,1968 ****
39d3d53
  		/* Special case: gH deletes the last line. */
39d3d53
  		del_lines(1L, FALSE);
39d3d53
  		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
39d3d53
! 		if (curwin->w_cursor.lnum > 1)
39d3d53
! 		    --curwin->w_cursor.lnum;
39d3d53
  	    }
39d3d53
  	    else
39d3d53
  	    {
39d3d53
--- 1962,1969 ----
39d3d53
  		/* Special case: gH deletes the last line. */
39d3d53
  		del_lines(1L, FALSE);
39d3d53
  		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
39d3d53
! 		if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
39d3d53
! 		    curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
39d3d53
  	    }
39d3d53
  	    else
39d3d53
  	    {
39d3d53
***************
39d3d53
*** 4434,4440 ****
39d3d53
  #endif
39d3d53
  
39d3d53
  /*
39d3d53
!  * implementation of the format operator 'gq'
39d3d53
   */
39d3d53
      void
39d3d53
  op_format(oap, keep_cursor)
39d3d53
--- 4435,4441 ----
39d3d53
  #endif
39d3d53
  
39d3d53
  /*
39d3d53
!  * Implementation of the format operator 'gq'.
39d3d53
   */
39d3d53
      void
39d3d53
  op_format(oap, keep_cursor)
39d3d53
*** ../vim-7.3.394/src/testdir/test43.in	2010-08-15 21:57:29.000000000 +0200
39d3d53
--- src/testdir/test43.in	2012-01-10 13:41:13.000000000 +0100
39d3d53
***************
39d3d53
*** 13,19 ****
39d3d53
  x:set magic
39d3d53
  /\v(a)(b)\2\1\1/e
39d3d53
  x/\V[ab]\(\[xy]\)\1
39d3d53
! x:?^1?,$w! test.out
39d3d53
  :qa!
39d3d53
  ENDTEST
39d3d53
  
39d3d53
--- 13,23 ----
39d3d53
  x:set magic
39d3d53
  /\v(a)(b)\2\1\1/e
39d3d53
  x/\V[ab]\(\[xy]\)\1
39d3d53
! x:$
39d3d53
! :set undolevels=100
39d3d53
! dv?bar?
39d3d53
! Yup:"
39d3d53
! :?^1?,$w! test.out
39d3d53
  :qa!
39d3d53
  ENDTEST
39d3d53
  
39d3d53
***************
39d3d53
*** 25,27 ****
39d3d53
--- 29,33 ----
39d3d53
  6 x ^aa$ x
39d3d53
  7 (a)(b) abbaa
39d3d53
  8 axx [ab]xx
39d3d53
+ 9 foobar
39d3d53
+ 
39d3d53
*** ../vim-7.3.394/src/testdir/test43.ok	2010-08-15 21:57:29.000000000 +0200
39d3d53
--- src/testdir/test43.ok	2012-01-10 13:42:39.000000000 +0100
39d3d53
***************
39d3d53
*** 6,8 ****
39d3d53
--- 6,11 ----
39d3d53
  6 x aa$ x
39d3d53
  7 (a)(b) abba
39d3d53
  8 axx ab]xx
39d3d53
+ 9 foobar
39d3d53
+ 9 foo
39d3d53
+ 
39d3d53
*** ../vim-7.3.394/src/version.c	2012-01-10 12:42:05.000000000 +0100
39d3d53
--- src/version.c	2012-01-10 13:30:40.000000000 +0100
39d3d53
***************
39d3d53
*** 716,717 ****
39d3d53
--- 716,719 ----
39d3d53
  {   /* Add new patch number below this line */
39d3d53
+ /**/
39d3d53
+     395,
39d3d53
  /**/
39d3d53
39d3d53
-- 
39d3d53
The Law, in its majestic equality, forbids the rich, as well as the
39d3d53
poor, to sleep under the bridges, to beg in the streets, and to steal
39d3d53
bread.                       -- Anatole France
39d3d53
39d3d53
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
39d3d53
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
39d3d53
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
39d3d53
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///