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