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