Karsten Hopp 1d826f
To: vim_dev@googlegroups.com
Karsten Hopp 1d826f
Subject: Patch 7.3.452
Karsten Hopp 1d826f
Fcc: outbox
Karsten Hopp 1d826f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1d826f
Mime-Version: 1.0
Karsten Hopp 1d826f
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 1d826f
Content-Transfer-Encoding: 8bit
Karsten Hopp 1d826f
------------
Karsten Hopp 1d826f
Karsten Hopp 1d826f
Patch 7.3.452
Karsten Hopp 1d826f
Problem:    Undo broken when pasting close to the last line. (Andrey Radev)
Karsten Hopp 1d826f
Solution:   Use a flag to remember if the deleted included the last line.
Karsten Hopp 1d826f
	    (Christian Brabandt)
Karsten Hopp 1d826f
Files:	    src/ops.c
Karsten Hopp 1d826f
Karsten Hopp 1d826f
Karsten Hopp 1d826f
*** ../vim-7.3.451/src/ops.c	2012-01-10 13:46:18.000000000 +0100
Karsten Hopp 1d826f
--- src/ops.c	2012-02-22 17:32:40.000000000 +0100
Karsten Hopp 1d826f
***************
Karsten Hopp 1d826f
*** 1943,1954 ****
Karsten Hopp 1d826f
--- 1943,1956 ----
Karsten Hopp 1d826f
  	else				/* delete characters between lines */
Karsten Hopp 1d826f
  	{
Karsten Hopp 1d826f
  	    pos_T   curpos;
Karsten Hopp 1d826f
+ 	    int     delete_last_line;
Karsten Hopp 1d826f
  
Karsten Hopp 1d826f
  	    /* save deleted and changed lines for undo */
Karsten Hopp 1d826f
  	    if (u_save((linenr_T)(curwin->w_cursor.lnum - 1),
Karsten Hopp 1d826f
  		 (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL)
Karsten Hopp 1d826f
  		return FAIL;
Karsten Hopp 1d826f
  
Karsten Hopp 1d826f
+ 	    delete_last_line = (oap->end.lnum == curbuf->b_ml.ml_line_count);
Karsten Hopp 1d826f
  	    truncate_line(TRUE);	/* delete from cursor to end of line */
Karsten Hopp 1d826f
  
Karsten Hopp 1d826f
  	    curpos = curwin->w_cursor;	/* remember curwin->w_cursor */
Karsten Hopp 1d826f
***************
Karsten Hopp 1d826f
*** 1956,1962 ****
Karsten Hopp 1d826f
  	    del_lines((long)(oap->line_count - 2), FALSE);
Karsten Hopp 1d826f
  
Karsten Hopp 1d826f
  	    n = (oap->end.col + 1 - !oap->inclusive);
Karsten Hopp 1d826f
! 	    if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
Karsten Hopp 1d826f
  		    && n > (int)STRLEN(ml_get(oap->end.lnum)))
Karsten Hopp 1d826f
  	    {
Karsten Hopp 1d826f
  		/* Special case: gH deletes the last line. */
Karsten Hopp 1d826f
--- 1958,1964 ----
Karsten Hopp 1d826f
  	    del_lines((long)(oap->line_count - 2), FALSE);
Karsten Hopp 1d826f
  
Karsten Hopp 1d826f
  	    n = (oap->end.col + 1 - !oap->inclusive);
Karsten Hopp 1d826f
! 	    if (oap->inclusive && delete_last_line
Karsten Hopp 1d826f
  		    && n > (int)STRLEN(ml_get(oap->end.lnum)))
Karsten Hopp 1d826f
  	    {
Karsten Hopp 1d826f
  		/* Special case: gH deletes the last line. */
Karsten Hopp 1d826f
*** ../vim-7.3.451/src/version.c	2012-02-22 16:01:53.000000000 +0100
Karsten Hopp 1d826f
--- src/version.c	2012-02-22 17:37:18.000000000 +0100
Karsten Hopp 1d826f
***************
Karsten Hopp 1d826f
*** 716,717 ****
Karsten Hopp 1d826f
--- 716,719 ----
Karsten Hopp 1d826f
  {   /* Add new patch number below this line */
Karsten Hopp 1d826f
+ /**/
Karsten Hopp 1d826f
+     452,
Karsten Hopp 1d826f
  /**/
Karsten Hopp 1d826f
Karsten Hopp 1d826f
-- 
Karsten Hopp 1d826f
From "know your smileys":
Karsten Hopp 1d826f
 =):-)	Uncle Sam
Karsten Hopp 1d826f
Karsten Hopp 1d826f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1d826f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1d826f
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 1d826f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///