Karsten Hopp 0cb66d
To: vim-dev@vim.org
Karsten Hopp 0cb66d
Subject: Patch 7.1.264
Karsten Hopp 0cb66d
Fcc: outbox
Karsten Hopp 0cb66d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 0cb66d
Mime-Version: 1.0
Karsten Hopp 0cb66d
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 0cb66d
Content-Transfer-Encoding: 8bit
Karsten Hopp 0cb66d
------------
Karsten Hopp 0cb66d
Karsten Hopp 0cb66d
Patch 7.1.264
Karsten Hopp 0cb66d
Problem:    Crash when indenting lines. (Dominique Pelle)
Karsten Hopp 0cb66d
Solution:   Set the cursor column when changing the cursor line.
Karsten Hopp 0cb66d
Files:	    src/ops.c, src/misc1.c
Karsten Hopp 0cb66d
Karsten Hopp 0cb66d
Karsten Hopp 0cb66d
*** ../vim-7.1.263/src/ops.c	Wed Feb  6 14:43:50 2008
Karsten Hopp 0cb66d
--- src/ops.c	Sun Feb 24 14:56:38 2008
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 692,697 ****
Karsten Hopp 0cb66d
--- 692,698 ----
Karsten Hopp 0cb66d
  	    }
Karsten Hopp 0cb66d
  	}
Karsten Hopp 0cb66d
  	++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 	curwin->w_cursor.col = 0;  /* make sure it's valid */
Karsten Hopp 0cb66d
      }
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
      /* put cursor on first non-blank of indented line */
Karsten Hopp 0cb66d
*** ../vim-7.1.263/src/misc1.c	Wed Feb 13 10:57:11 2008
Karsten Hopp 0cb66d
--- src/misc1.c	Sun Feb 24 15:04:27 2008
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 6894,6899 ****
Karsten Hopp 0cb66d
--- 6894,6900 ----
Karsten Hopp 0cb66d
  			if (trypos != NULL)
Karsten Hopp 0cb66d
  			{
Karsten Hopp 0cb66d
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 0cb66d
+ 			    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  			    continue;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 6954,6959 ****
Karsten Hopp 0cb66d
--- 6955,6961 ----
Karsten Hopp 0cb66d
  			    if (trypos != NULL)
Karsten Hopp 0cb66d
  			    {
Karsten Hopp 0cb66d
  				curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 0cb66d
+ 				curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  				continue;
Karsten Hopp 0cb66d
  			    }
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 6991,6996 ****
Karsten Hopp 0cb66d
--- 6993,6999 ----
Karsten Hopp 0cb66d
  		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
  		{
Karsten Hopp 0cb66d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 0cb66d
+ 		    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  		    continue;
Karsten Hopp 0cb66d
  		}
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7114,7120 ****
Karsten Hopp 0cb66d
--- 7117,7126 ----
Karsten Hopp 0cb66d
  		{
Karsten Hopp 0cb66d
  		    if (find_last_paren(l, '{', '}') && (trypos =
Karsten Hopp 0cb66d
  				    find_start_brace(ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
+ 		    {
Karsten Hopp 0cb66d
  			curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 0cb66d
+ 			curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
+ 		    }
Karsten Hopp 0cb66d
  		    continue;
Karsten Hopp 0cb66d
  		}
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7230,7240 ****
Karsten Hopp 0cb66d
  			 *     case xx:  if ( asdf &&
Karsten Hopp 0cb66d
  			 *			asdf)
Karsten Hopp 0cb66d
  			 */
Karsten Hopp 0cb66d
! 			curwin->w_cursor.lnum = trypos->lnum;
Karsten Hopp 0cb66d
  			l = ml_get_curline();
Karsten Hopp 0cb66d
  			if (cin_iscase(l) || cin_isscopedecl(l))
Karsten Hopp 0cb66d
  			{
Karsten Hopp 0cb66d
  			    ++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
  			    continue;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
--- 7236,7247 ----
Karsten Hopp 0cb66d
  			 *     case xx:  if ( asdf &&
Karsten Hopp 0cb66d
  			 *			asdf)
Karsten Hopp 0cb66d
  			 */
Karsten Hopp 0cb66d
! 			curwin->w_cursor = *trypos;
Karsten Hopp 0cb66d
  			l = ml_get_curline();
Karsten Hopp 0cb66d
  			if (cin_iscase(l) || cin_isscopedecl(l))
Karsten Hopp 0cb66d
  			{
Karsten Hopp 0cb66d
  			    ++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 			    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  			    continue;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7254,7259 ****
Karsten Hopp 0cb66d
--- 7261,7267 ----
Karsten Hopp 0cb66d
  			    if (*l == NUL || l[STRLEN(l) - 1] != '\\')
Karsten Hopp 0cb66d
  				break;
Karsten Hopp 0cb66d
  			    --curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 			    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7587,7597 ****
Karsten Hopp 0cb66d
  			     *	   case xx:  if ( asdf &&
Karsten Hopp 0cb66d
  			     *			    asdf)
Karsten Hopp 0cb66d
  			     */
Karsten Hopp 0cb66d
! 			    curwin->w_cursor.lnum = trypos->lnum;
Karsten Hopp 0cb66d
  			    l = ml_get_curline();
Karsten Hopp 0cb66d
  			    if (cin_iscase(l) || cin_isscopedecl(l))
Karsten Hopp 0cb66d
  			    {
Karsten Hopp 0cb66d
  				++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
  				continue;
Karsten Hopp 0cb66d
  			    }
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
--- 7595,7606 ----
Karsten Hopp 0cb66d
  			     *	   case xx:  if ( asdf &&
Karsten Hopp 0cb66d
  			     *			    asdf)
Karsten Hopp 0cb66d
  			     */
Karsten Hopp 0cb66d
! 			    curwin->w_cursor = *trypos;
Karsten Hopp 0cb66d
  			    l = ml_get_curline();
Karsten Hopp 0cb66d
  			    if (cin_iscase(l) || cin_isscopedecl(l))
Karsten Hopp 0cb66d
  			    {
Karsten Hopp 0cb66d
  				++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 				curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  				continue;
Karsten Hopp 0cb66d
  			    }
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7652,7664 ****
Karsten Hopp 0cb66d
  				&& (trypos = find_start_brace(ind_maxcomment))
Karsten Hopp 0cb66d
  							    != NULL) /* XXX */
Karsten Hopp 0cb66d
  			{
Karsten Hopp 0cb66d
! 			    curwin->w_cursor.lnum = trypos->lnum;
Karsten Hopp 0cb66d
  			    /* if not "else {" check for terminated again */
Karsten Hopp 0cb66d
  			    /* but skip block for "} else {" */
Karsten Hopp 0cb66d
  			    l = cin_skipcomment(ml_get_curline());
Karsten Hopp 0cb66d
  			    if (*l == '}' || !cin_iselse(l))
Karsten Hopp 0cb66d
  				goto term_again;
Karsten Hopp 0cb66d
  			    ++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
  		}
Karsten Hopp 0cb66d
--- 7661,7674 ----
Karsten Hopp 0cb66d
  				&& (trypos = find_start_brace(ind_maxcomment))
Karsten Hopp 0cb66d
  							    != NULL) /* XXX */
Karsten Hopp 0cb66d
  			{
Karsten Hopp 0cb66d
! 			    curwin->w_cursor = *trypos;
Karsten Hopp 0cb66d
  			    /* if not "else {" check for terminated again */
Karsten Hopp 0cb66d
  			    /* but skip block for "} else {" */
Karsten Hopp 0cb66d
  			    l = cin_skipcomment(ml_get_curline());
Karsten Hopp 0cb66d
  			    if (*l == '}' || !cin_iselse(l))
Karsten Hopp 0cb66d
  				goto term_again;
Karsten Hopp 0cb66d
  			    ++curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 			    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  			}
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
  		}
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7727,7732 ****
Karsten Hopp 0cb66d
--- 7737,7743 ----
Karsten Hopp 0cb66d
  		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
  		{
Karsten Hopp 0cb66d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 0cb66d
+ 		    curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  		    continue;
Karsten Hopp 0cb66d
  		}
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7777,7783 ****
Karsten Hopp 0cb66d
  		    if (find_last_paren(l, '(', ')')
Karsten Hopp 0cb66d
  			    && (trypos = find_match_paren(ind_maxparen,
Karsten Hopp 0cb66d
  						     ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
! 			curwin->w_cursor.lnum = trypos->lnum;
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
  		    /* For a line ending in ',' that is a continuation line go
Karsten Hopp 0cb66d
  		     * back to the first line with a backslash:
Karsten Hopp 0cb66d
--- 7788,7794 ----
Karsten Hopp 0cb66d
  		    if (find_last_paren(l, '(', ')')
Karsten Hopp 0cb66d
  			    && (trypos = find_match_paren(ind_maxparen,
Karsten Hopp 0cb66d
  						     ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
! 			curwin->w_cursor = *trypos;
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
  		    /* For a line ending in ',' that is a continuation line go
Karsten Hopp 0cb66d
  		     * back to the first line with a backslash:
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7791,7796 ****
Karsten Hopp 0cb66d
--- 7802,7808 ----
Karsten Hopp 0cb66d
  			if (*l == NUL || l[STRLEN(l) - 1] != '\\')
Karsten Hopp 0cb66d
  			    break;
Karsten Hopp 0cb66d
  			--curwin->w_cursor.lnum;
Karsten Hopp 0cb66d
+ 			curwin->w_cursor.col = 0;
Karsten Hopp 0cb66d
  		    }
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
  		    amount = get_indent();	    /* XXX */
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 7864,7870 ****
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
  		if ((trypos = find_match_paren(ind_maxparen,
Karsten Hopp 0cb66d
  						     ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
! 		    curwin->w_cursor.lnum = trypos->lnum;
Karsten Hopp 0cb66d
  		amount = get_indent();	    /* XXX */
Karsten Hopp 0cb66d
  		break;
Karsten Hopp 0cb66d
  	    }
Karsten Hopp 0cb66d
--- 7876,7882 ----
Karsten Hopp 0cb66d
  
Karsten Hopp 0cb66d
  		if ((trypos = find_match_paren(ind_maxparen,
Karsten Hopp 0cb66d
  						     ind_maxcomment)) != NULL)
Karsten Hopp 0cb66d
! 		    curwin->w_cursor = *trypos;
Karsten Hopp 0cb66d
  		amount = get_indent();	    /* XXX */
Karsten Hopp 0cb66d
  		break;
Karsten Hopp 0cb66d
  	    }
Karsten Hopp 0cb66d
*** ../vim-7.1.263/src/version.c	Mon Feb 25 20:45:46 2008
Karsten Hopp 0cb66d
--- src/version.c	Mon Feb 25 21:51:20 2008
Karsten Hopp 0cb66d
***************
Karsten Hopp 0cb66d
*** 668,669 ****
Karsten Hopp 0cb66d
--- 668,671 ----
Karsten Hopp 0cb66d
  {   /* Add new patch number below this line */
Karsten Hopp 0cb66d
+ /**/
Karsten Hopp 0cb66d
+     264,
Karsten Hopp 0cb66d
  /**/
Karsten Hopp 0cb66d
Karsten Hopp 0cb66d
-- 
Karsten Hopp 0cb66d
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 0cb66d
49. You never have to deal with busy signals when calling your ISP...because
Karsten Hopp 0cb66d
    you never log off.
Karsten Hopp 0cb66d
Karsten Hopp 0cb66d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 0cb66d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 0cb66d
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 0cb66d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///