2102f06
To: vim-dev@vim.org
2102f06
Subject: Patch 7.2.189
2102f06
Fcc: outbox
2102f06
From: Bram Moolenaar <Bram@moolenaar.net>
2102f06
Mime-Version: 1.0
2102f06
Content-Type: text/plain; charset=UTF-8
2102f06
Content-Transfer-Encoding: 8bit
2102f06
------------
2102f06
2102f06
Patch 7.2.189
2102f06
Problem:    Possible hang for deleting auto-indent. (Dominique Pelle)
2102f06
Solution:   Make sure the position is not beyond the end of the line.
2102f06
Files:	    src/edit.c
2102f06
2102f06
2102f06
*** ../vim-7.2.188/src/edit.c	2009-05-16 16:36:25.000000000 +0200
2102f06
--- src/edit.c	2009-05-26 10:53:05.000000000 +0200
2102f06
***************
2102f06
*** 6420,6432 ****
2102f06
  
2102f06
  	/* If we just did an auto-indent, remove the white space from the end
2102f06
  	 * of the line, and put the cursor back.
2102f06
! 	 * Do this when ESC was used or moving the cursor up/down. */
2102f06
  	if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
2102f06
! 			&& curwin->w_cursor.lnum != end_insert_pos->lnum)))
2102f06
  	{
2102f06
  	    pos_T	tpos = curwin->w_cursor;
2102f06
  
2102f06
  	    curwin->w_cursor = *end_insert_pos;
2102f06
  	    for (;;)
2102f06
  	    {
2102f06
  		if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
2102f06
--- 6420,6436 ----
2102f06
  
2102f06
  	/* If we just did an auto-indent, remove the white space from the end
2102f06
  	 * of the line, and put the cursor back.
2102f06
! 	 * Do this when ESC was used or moving the cursor up/down.
2102f06
! 	 * Check for the old position still being valid, just in case the text
2102f06
! 	 * got changed unexpectedly. */
2102f06
  	if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
2102f06
! 			&& curwin->w_cursor.lnum != end_insert_pos->lnum))
2102f06
! 		&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
2102f06
  	{
2102f06
  	    pos_T	tpos = curwin->w_cursor;
2102f06
  
2102f06
  	    curwin->w_cursor = *end_insert_pos;
2102f06
+ 	    check_cursor_col();  /* make sure it is not past the line */
2102f06
  	    for (;;)
2102f06
  	    {
2102f06
  		if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
2102f06
***************
2102f06
*** 6434,6440 ****
2102f06
  		cc = gchar_cursor();
2102f06
  		if (!vim_iswhite(cc))
2102f06
  		    break;
2102f06
! 		(void)del_char(TRUE);
2102f06
  	    }
2102f06
  	    if (curwin->w_cursor.lnum != tpos.lnum)
2102f06
  		curwin->w_cursor = tpos;
2102f06
--- 6438,6445 ----
2102f06
  		cc = gchar_cursor();
2102f06
  		if (!vim_iswhite(cc))
2102f06
  		    break;
2102f06
! 		if (del_char(TRUE) == FAIL)
2102f06
! 		    break;  /* should not happen */
2102f06
  	    }
2102f06
  	    if (curwin->w_cursor.lnum != tpos.lnum)
2102f06
  		curwin->w_cursor = tpos;
2102f06
*** ../vim-7.2.188/src/version.c	2009-05-24 13:40:17.000000000 +0200
2102f06
--- src/version.c	2009-05-26 10:50:53.000000000 +0200
2102f06
***************
2102f06
*** 678,679 ****
2102f06
--- 678,681 ----
2102f06
  {   /* Add new patch number below this line */
2102f06
+ /**/
2102f06
+     189,
2102f06
  /**/
2102f06
2102f06
-- 
2102f06
FIRST VILLAGER: We have found a witch.  May we burn her?
2102f06
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
2102f06
2102f06
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
2102f06
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
2102f06
\\\        download, build and distribute -- http://www.A-A-P.org        ///
2102f06
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///