Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.264
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.264
Problem:    Crash when indenting lines. (Dominique Pelle)
Solution:   Set the cursor column when changing the cursor line.
Files:	    src/ops.c, src/misc1.c


*** ../vim-7.1.263/src/ops.c	Wed Feb  6 14:43:50 2008
--- src/ops.c	Sun Feb 24 14:56:38 2008
***************
*** 692,697 ****
--- 692,698 ----
  	    }
  	}
  	++curwin->w_cursor.lnum;
+ 	curwin->w_cursor.col = 0;  /* make sure it's valid */
      }
  
      /* put cursor on first non-blank of indented line */
*** ../vim-7.1.263/src/misc1.c	Wed Feb 13 10:57:11 2008
--- src/misc1.c	Sun Feb 24 15:04:27 2008
***************
*** 6894,6899 ****
--- 6894,6900 ----
  			if (trypos != NULL)
  			{
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
+ 			    curwin->w_cursor.col = 0;
  			    continue;
  			}
  
***************
*** 6954,6959 ****
--- 6955,6961 ----
  			    if (trypos != NULL)
  			    {
  				curwin->w_cursor.lnum = trypos->lnum + 1;
+ 				curwin->w_cursor.col = 0;
  				continue;
  			    }
  			}
***************
*** 6991,6996 ****
--- 6993,6999 ----
  		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
+ 		    curwin->w_cursor.col = 0;
  		    continue;
  		}
  
***************
*** 7114,7120 ****
--- 7117,7126 ----
  		{
  		    if (find_last_paren(l, '{', '}') && (trypos =
  				    find_start_brace(ind_maxcomment)) != NULL)
+ 		    {
  			curwin->w_cursor.lnum = trypos->lnum + 1;
+ 			curwin->w_cursor.col = 0;
+ 		    }
  		    continue;
  		}
  
***************
*** 7230,7240 ****
  			 *     case xx:  if ( asdf &&
  			 *			asdf)
  			 */
! 			curwin->w_cursor.lnum = trypos->lnum;
  			l = ml_get_curline();
  			if (cin_iscase(l) || cin_isscopedecl(l))
  			{
  			    ++curwin->w_cursor.lnum;
  			    continue;
  			}
  		    }
--- 7236,7247 ----
  			 *     case xx:  if ( asdf &&
  			 *			asdf)
  			 */
! 			curwin->w_cursor = *trypos;
  			l = ml_get_curline();
  			if (cin_iscase(l) || cin_isscopedecl(l))
  			{
  			    ++curwin->w_cursor.lnum;
+ 			    curwin->w_cursor.col = 0;
  			    continue;
  			}
  		    }
***************
*** 7254,7259 ****
--- 7261,7267 ----
  			    if (*l == NUL || l[STRLEN(l) - 1] != '\\')
  				break;
  			    --curwin->w_cursor.lnum;
+ 			    curwin->w_cursor.col = 0;
  			}
  		    }
  
***************
*** 7587,7597 ****
  			     *	   case xx:  if ( asdf &&
  			     *			    asdf)
  			     */
! 			    curwin->w_cursor.lnum = trypos->lnum;
  			    l = ml_get_curline();
  			    if (cin_iscase(l) || cin_isscopedecl(l))
  			    {
  				++curwin->w_cursor.lnum;
  				continue;
  			    }
  			}
--- 7595,7606 ----
  			     *	   case xx:  if ( asdf &&
  			     *			    asdf)
  			     */
! 			    curwin->w_cursor = *trypos;
  			    l = ml_get_curline();
  			    if (cin_iscase(l) || cin_isscopedecl(l))
  			    {
  				++curwin->w_cursor.lnum;
+ 				curwin->w_cursor.col = 0;
  				continue;
  			    }
  			}
***************
*** 7652,7664 ****
  				&& (trypos = find_start_brace(ind_maxcomment))
  							    != NULL) /* XXX */
  			{
! 			    curwin->w_cursor.lnum = trypos->lnum;
  			    /* if not "else {" check for terminated again */
  			    /* but skip block for "} else {" */
  			    l = cin_skipcomment(ml_get_curline());
  			    if (*l == '}' || !cin_iselse(l))
  				goto term_again;
  			    ++curwin->w_cursor.lnum;
  			}
  		    }
  		}
--- 7661,7674 ----
  				&& (trypos = find_start_brace(ind_maxcomment))
  							    != NULL) /* XXX */
  			{
! 			    curwin->w_cursor = *trypos;
  			    /* if not "else {" check for terminated again */
  			    /* but skip block for "} else {" */
  			    l = cin_skipcomment(ml_get_curline());
  			    if (*l == '}' || !cin_iselse(l))
  				goto term_again;
  			    ++curwin->w_cursor.lnum;
+ 			    curwin->w_cursor.col = 0;
  			}
  		    }
  		}
***************
*** 7727,7732 ****
--- 7737,7743 ----
  		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
+ 		    curwin->w_cursor.col = 0;
  		    continue;
  		}
  
***************
*** 7777,7783 ****
  		    if (find_last_paren(l, '(', ')')
  			    && (trypos = find_match_paren(ind_maxparen,
  						     ind_maxcomment)) != NULL)
! 			curwin->w_cursor.lnum = trypos->lnum;
  
  		    /* For a line ending in ',' that is a continuation line go
  		     * back to the first line with a backslash:
--- 7788,7794 ----
  		    if (find_last_paren(l, '(', ')')
  			    && (trypos = find_match_paren(ind_maxparen,
  						     ind_maxcomment)) != NULL)
! 			curwin->w_cursor = *trypos;
  
  		    /* For a line ending in ',' that is a continuation line go
  		     * back to the first line with a backslash:
***************
*** 7791,7796 ****
--- 7802,7808 ----
  			if (*l == NUL || l[STRLEN(l) - 1] != '\\')
  			    break;
  			--curwin->w_cursor.lnum;
+ 			curwin->w_cursor.col = 0;
  		    }
  
  		    amount = get_indent();	    /* XXX */
***************
*** 7864,7870 ****
  
  		if ((trypos = find_match_paren(ind_maxparen,
  						     ind_maxcomment)) != NULL)
! 		    curwin->w_cursor.lnum = trypos->lnum;
  		amount = get_indent();	    /* XXX */
  		break;
  	    }
--- 7876,7882 ----
  
  		if ((trypos = find_match_paren(ind_maxparen,
  						     ind_maxcomment)) != NULL)
! 		    curwin->w_cursor = *trypos;
  		amount = get_indent();	    /* XXX */
  		break;
  	    }
*** ../vim-7.1.263/src/version.c	Mon Feb 25 20:45:46 2008
--- src/version.c	Mon Feb 25 21:51:20 2008
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     264,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
49. You never have to deal with busy signals when calling your ISP...because
    you never log off.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///