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