To: vim_dev@googlegroups.com
Subject: Patch 7.4.071
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.071 (after 7.4.069)
Problem:    Passing limits around too often.
Solution:   Use limits from buffer.
Files:      src/edit.c, src/misc1.c, src/proto/misc1.pro


*** ../vim-7.4.070/src/edit.c	2013-11-05 07:12:59.000000000 +0100
--- src/edit.c	2013-11-06 03:19:10.000000000 +0100
***************
*** 7857,7864 ****
  	    if (try_match && keytyped == ':')
  	    {
  		p = ml_get_curline();
! 		if (cin_iscase(p, FALSE) || cin_isscopedecl(p)
! 							   || cin_islabel(30))
  		    return TRUE;
  		/* Need to get the line again after cin_islabel(). */
  		p = ml_get_curline();
--- 7857,7863 ----
  	    if (try_match && keytyped == ':')
  	    {
  		p = ml_get_curline();
! 		if (cin_iscase(p, FALSE) || cin_isscopedecl(p) || cin_islabel())
  		    return TRUE;
  		/* Need to get the line again after cin_islabel(). */
  		p = ml_get_curline();
***************
*** 7868,7874 ****
  		{
  		    p[curwin->w_cursor.col - 1] = ' ';
  		    i = (cin_iscase(p, FALSE) || cin_isscopedecl(p)
! 							  || cin_islabel(30));
  		    p = ml_get_curline();
  		    p[curwin->w_cursor.col - 1] = ':';
  		    if (i)
--- 7867,7873 ----
  		{
  		    p[curwin->w_cursor.col - 1] = ' ';
  		    i = (cin_iscase(p, FALSE) || cin_isscopedecl(p)
! 							    || cin_islabel());
  		    p = ml_get_curline();
  		    p[curwin->w_cursor.col - 1] = ':';
  		    if (i)
*** ../vim-7.4.070/src/misc1.c	2013-11-05 07:12:59.000000000 +0100
--- src/misc1.c	2013-11-06 03:46:59.000000000 +0100
***************
*** 5191,5201 ****
--- 5191,5208 ----
  #if defined(FEAT_CINDENT) || defined(FEAT_SYN_HL)
  
  static char_u	*skip_string __ARGS((char_u *p));
+ static pos_T *ind_find_start_comment __ARGS((void));
  
  /*
   * Find the start of a comment, not knowing if we are in a comment right now.
   * Search starts at w_cursor.lnum and goes backwards.
   */
+     static pos_T *
+ ind_find_start_comment()	    /* XXX */
+ {
+     return find_start_comment(curbuf->b_ind_maxcomment);
+ }
+ 
      pos_T *
  find_start_comment(ind_maxcomment)	    /* XXX */
      int		ind_maxcomment;
***************
*** 5313,5319 ****
  static int	cin_isdefault __ARGS((char_u *));
  static char_u	*after_label __ARGS((char_u *l));
  static int	get_indent_nolabel __ARGS((linenr_T lnum));
! static int	skip_label __ARGS((linenr_T, char_u **pp, int ind_maxcomment));
  static int	cin_first_id_amount __ARGS((void));
  static int	cin_get_equal_amount __ARGS((linenr_T lnum));
  static int	cin_ispreproc __ARGS((char_u *));
--- 5320,5326 ----
  static int	cin_isdefault __ARGS((char_u *));
  static char_u	*after_label __ARGS((char_u *l));
  static int	get_indent_nolabel __ARGS((linenr_T lnum));
! static int	skip_label __ARGS((linenr_T, char_u **pp));
  static int	cin_first_id_amount __ARGS((void));
  static int	cin_get_equal_amount __ARGS((linenr_T lnum));
  static int	cin_ispreproc __ARGS((char_u *));
***************
*** 5322,5345 ****
  static int	cin_islinecomment __ARGS((char_u *));
  static int	cin_isterminated __ARGS((char_u *, int, int));
  static int	cin_isinit __ARGS((void));
! static int	cin_isfuncdecl __ARGS((char_u **, linenr_T, linenr_T, int, int));
  static int	cin_isif __ARGS((char_u *));
  static int	cin_iselse __ARGS((char_u *));
  static int	cin_isdo __ARGS((char_u *));
! static int	cin_iswhileofdo __ARGS((char_u *, linenr_T, int));
  static int	cin_is_if_for_while_before_offset __ARGS((char_u *line, int *poffset));
! static int	cin_iswhileofdo_end __ARGS((int terminated, int	ind_maxparen, int ind_maxcomment));
  static int	cin_isbreak __ARGS((char_u *));
  static int	cin_is_cpp_baseclass __ARGS((colnr_T *col));
! static int	get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass));
  static int	cin_ends_in __ARGS((char_u *, char_u *, char_u *));
  static int	cin_starts_with __ARGS((char_u *s, char *word));
  static int	cin_skip2pos __ARGS((pos_T *trypos));
! static pos_T	*find_start_brace __ARGS((int));
! static pos_T	*find_match_paren __ARGS((int, int));
! static int	corr_ind_maxparen __ARGS((int ind_maxparen, pos_T *startpos));
  static int	find_last_paren __ARGS((char_u *l, int start, int end));
! static int	find_match __ARGS((int lookfor, linenr_T ourscope, int ind_maxparen, int ind_maxcomment));
  static int	cin_is_cpp_namespace __ARGS((char_u *));
  
  /*
--- 5329,5352 ----
  static int	cin_islinecomment __ARGS((char_u *));
  static int	cin_isterminated __ARGS((char_u *, int, int));
  static int	cin_isinit __ARGS((void));
! static int	cin_isfuncdecl __ARGS((char_u **, linenr_T, linenr_T));
  static int	cin_isif __ARGS((char_u *));
  static int	cin_iselse __ARGS((char_u *));
  static int	cin_isdo __ARGS((char_u *));
! static int	cin_iswhileofdo __ARGS((char_u *, linenr_T));
  static int	cin_is_if_for_while_before_offset __ARGS((char_u *line, int *poffset));
! static int	cin_iswhileofdo_end __ARGS((int terminated));
  static int	cin_isbreak __ARGS((char_u *));
  static int	cin_is_cpp_baseclass __ARGS((colnr_T *col));
! static int	get_baseclass_amount __ARGS((int col));
  static int	cin_ends_in __ARGS((char_u *, char_u *, char_u *));
  static int	cin_starts_with __ARGS((char_u *s, char *word));
  static int	cin_skip2pos __ARGS((pos_T *trypos));
! static pos_T	*find_start_brace __ARGS((void));
! static pos_T	*find_match_paren __ARGS((int));
! static int	corr_ind_maxparen __ARGS((pos_T *startpos));
  static int	find_last_paren __ARGS((char_u *l, int start, int end));
! static int	find_match __ARGS((int lookfor, linenr_T ourscope));
  static int	cin_is_cpp_namespace __ARGS((char_u *));
  
  /*
***************
*** 5444,5451 ****
   * Note: curwin->w_cursor must be where we are looking for the label.
   */
      int
! cin_islabel(ind_maxcomment)		/* XXX */
!     int		ind_maxcomment;
  {
      char_u	*s;
  
--- 5451,5457 ----
   * Note: curwin->w_cursor must be where we are looking for the label.
   */
      int
! cin_islabel()		/* XXX */
  {
      char_u	*s;
  
***************
*** 5479,5485 ****
  	     * If we're in a comment now, skip to the start of the comment.
  	     */
  	    curwin->w_cursor.col = 0;
! 	    if ((trypos = find_start_comment(ind_maxcomment)) != NULL) /* XXX */
  		curwin->w_cursor = *trypos;
  
  	    line = ml_get_curline();
--- 5485,5491 ----
  	     * If we're in a comment now, skip to the start of the comment.
  	     */
  	    curwin->w_cursor.col = 0;
! 	    if ((trypos = ind_find_start_comment()) != NULL) /* XXX */
  		curwin->w_cursor = *trypos;
  
  	    line = ml_get_curline();
***************
*** 5725,5734 ****
   *		^
   */
      static int
! skip_label(lnum, pp, ind_maxcomment)
      linenr_T	lnum;
      char_u	**pp;
-     int		ind_maxcomment;
  {
      char_u	*l;
      int		amount;
--- 5731,5739 ----
   *		^
   */
      static int
! skip_label(lnum, pp)
      linenr_T	lnum;
      char_u	**pp;
  {
      char_u	*l;
      int		amount;
***************
*** 5738,5745 ****
      curwin->w_cursor.lnum = lnum;
      l = ml_get_curline();
  				    /* XXX */
!     if (cin_iscase(l, FALSE) || cin_isscopedecl(l)
! 					       || cin_islabel(ind_maxcomment))
      {
  	amount = get_indent_nolabel(lnum);
  	l = after_label(ml_get_curline());
--- 5743,5749 ----
      curwin->w_cursor.lnum = lnum;
      l = ml_get_curline();
  				    /* XXX */
!     if (cin_iscase(l, FALSE) || cin_isscopedecl(l) || cin_islabel())
      {
  	amount = get_indent_nolabel(lnum);
  	l = after_label(ml_get_curline());
***************
*** 5983,5994 ****
   * "min_lnum" is the line before which we will not be looking.
   */
      static int
! cin_isfuncdecl(sp, first_lnum, min_lnum, ind_maxparen, ind_maxcomment)
      char_u	**sp;
      linenr_T	first_lnum;
      linenr_T	min_lnum;
-     int		ind_maxparen;
-     int		ind_maxcomment;
  {
      char_u	*s;
      linenr_T	lnum = first_lnum;
--- 5987,5996 ----
   * "min_lnum" is the line before which we will not be looking.
   */
      static int
! cin_isfuncdecl(sp, first_lnum, min_lnum)
      char_u	**sp;
      linenr_T	first_lnum;
      linenr_T	min_lnum;
  {
      char_u	*s;
      linenr_T	lnum = first_lnum;
***************
*** 6002,6008 ****
  	s = *sp;
  
      if (find_last_paren(s, '(', ')')
! 	&& (trypos = find_match_paren(ind_maxparen, ind_maxcomment)) != NULL)
      {
  	lnum = trypos->lnum;
  	if (lnum < min_lnum)
--- 6004,6010 ----
  	s = *sp;
  
      if (find_last_paren(s, '(', ')')
! 	&& (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
      {
  	lnum = trypos->lnum;
  	if (lnum < min_lnum)
***************
*** 6110,6119 ****
   * ')' and ';'. The condition may be spread over several lines.
   */
      static int
! cin_iswhileofdo(p, lnum, ind_maxparen)	    /* XXX */
      char_u	*p;
      linenr_T	lnum;
-     int		ind_maxparen;
  {
      pos_T	cursor_save;
      pos_T	*trypos;
--- 6112,6120 ----
   * ')' and ';'. The condition may be spread over several lines.
   */
      static int
! cin_iswhileofdo(p, lnum)	    /* XXX */
      char_u	*p;
      linenr_T	lnum;
  {
      pos_T	cursor_save;
      pos_T	*trypos;
***************
*** 6133,6139 ****
  	    ++p;
  	    ++curwin->w_cursor.col;
  	}
! 	if ((trypos = findmatchlimit(NULL, 0, 0, ind_maxparen)) != NULL
  		&& *cin_skipcomment(ml_get_pos(trypos) + 1) == ';')
  	    retval = TRUE;
  	curwin->w_cursor = cursor_save;
--- 6134,6141 ----
  	    ++p;
  	    ++curwin->w_cursor.col;
  	}
! 	if ((trypos = findmatchlimit(NULL, 0, 0,
! 					      curbuf->b_ind_maxparen)) != NULL
  		&& *cin_skipcomment(ml_get_pos(trypos) + 1) == ';')
  	    retval = TRUE;
  	curwin->w_cursor = cursor_save;
***************
*** 6196,6205 ****
   * Adjust the cursor to the line with "while".
   */
      static int
! cin_iswhileofdo_end(terminated, ind_maxparen, ind_maxcomment)
      int	    terminated;
-     int	    ind_maxparen;
-     int	    ind_maxcomment;
  {
      char_u	*line;
      char_u	*p;
--- 6198,6205 ----
   * Adjust the cursor to the line with "while".
   */
      static int
! cin_iswhileofdo_end(terminated)
      int	    terminated;
  {
      char_u	*line;
      char_u	*p;
***************
*** 6223,6229 ****
  		 * before the matching '('.  XXX */
  		i = (int)(p - line);
  		curwin->w_cursor.col = i;
! 		trypos = find_match_paren(ind_maxparen, ind_maxcomment);
  		if (trypos != NULL)
  		{
  		    s = cin_skipcomment(ml_get(trypos->lnum));
--- 6223,6229 ----
  		 * before the matching '('.  XXX */
  		i = (int)(p - line);
  		curwin->w_cursor.col = i;
! 		trypos = find_match_paren(curbuf->b_ind_maxparen);
  		if (trypos != NULL)
  		{
  		    s = cin_skipcomment(ml_get(trypos->lnum));
***************
*** 6415,6425 ****
  }
  
      static int
! get_baseclass_amount(col, ind_maxparen, ind_maxcomment, ind_cpp_baseclass)
      int		col;
-     int		ind_maxparen;
-     int		ind_maxcomment;
-     int		ind_cpp_baseclass;
  {
      int		amount;
      colnr_T	vcol;
--- 6415,6422 ----
  }
  
      static int
! get_baseclass_amount(col)
      int		col;
  {
      int		amount;
      colnr_T	vcol;
***************
*** 6429,6439 ****
      {
  	amount = get_indent();
  	if (find_last_paren(ml_get_curline(), '(', ')')
! 		&& (trypos = find_match_paren(ind_maxparen,
! 						     ind_maxcomment)) != NULL)
  	    amount = get_indent_lnum(trypos->lnum); /* XXX */
  	if (!cin_ends_in(ml_get_curline(), (char_u *)",", NULL))
! 	    amount += ind_cpp_baseclass;
      }
      else
      {
--- 6426,6435 ----
      {
  	amount = get_indent();
  	if (find_last_paren(ml_get_curline(), '(', ')')
! 		&& (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
  	    amount = get_indent_lnum(trypos->lnum); /* XXX */
  	if (!cin_ends_in(ml_get_curline(), (char_u *)",", NULL))
! 	    amount += curbuf->b_ind_cpp_baseclass;
      }
      else
      {
***************
*** 6441,6448 ****
  	getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL);
  	amount = (int)vcol;
      }
!     if (amount < ind_cpp_baseclass)
! 	amount = ind_cpp_baseclass;
      return amount;
  }
  
--- 6437,6444 ----
  	getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL);
  	amount = (int)vcol;
      }
!     if (amount < curbuf->b_ind_cpp_baseclass)
! 	amount = curbuf->b_ind_cpp_baseclass;
      return amount;
  }
  
***************
*** 6526,6533 ****
  /* }	    */
  
      static pos_T *
! find_start_brace(ind_maxcomment)	    /* XXX */
!     int		ind_maxcomment;
  {
      pos_T	cursor_save;
      pos_T	*trypos;
--- 6522,6528 ----
  /* }	    */
  
      static pos_T *
! find_start_brace()	    /* XXX */
  {
      pos_T	cursor_save;
      pos_T	*trypos;
***************
*** 6543,6549 ****
  	pos = NULL;
  	/* ignore the { if it's in a // or / *  * / comment */
  	if ((colnr_T)cin_skip2pos(trypos) == trypos->col
! 		&& (pos = find_start_comment(ind_maxcomment)) == NULL) /* XXX */
  	    break;
  	if (pos != NULL)
  	    curwin->w_cursor.lnum = pos->lnum;
--- 6538,6544 ----
  	pos = NULL;
  	/* ignore the { if it's in a // or / *  * / comment */
  	if ((colnr_T)cin_skip2pos(trypos) == trypos->col
! 		       && (pos = ind_find_start_comment()) == NULL) /* XXX */
  	    break;
  	if (pos != NULL)
  	    curwin->w_cursor.lnum = pos->lnum;
***************
*** 6557,6565 ****
   * Return NULL if no match found.
   */
      static pos_T *
! find_match_paren(ind_maxparen, ind_maxcomment)	    /* XXX */
      int		ind_maxparen;
-     int		ind_maxcomment;
  {
      pos_T	cursor_save;
      pos_T	*trypos;
--- 6552,6559 ----
   * Return NULL if no match found.
   */
      static pos_T *
! find_match_paren(ind_maxparen)	    /* XXX */
      int		ind_maxparen;
  {
      pos_T	cursor_save;
      pos_T	*trypos;
***************
*** 6576,6582 ****
  	    pos_copy = *trypos;	    /* copy trypos, findmatch will change it */
  	    trypos = &pos_copy;
  	    curwin->w_cursor = *trypos;
! 	    if (find_start_comment(ind_maxcomment) != NULL) /* XXX */
  		trypos = NULL;
  	}
      }
--- 6570,6576 ----
  	    pos_copy = *trypos;	    /* copy trypos, findmatch will change it */
  	    trypos = &pos_copy;
  	    curwin->w_cursor = *trypos;
! 	    if (ind_find_start_comment() != NULL) /* XXX */
  		trypos = NULL;
  	}
      }
***************
*** 6591,6605 ****
   * looking a few lines further.
   */
      static int
! corr_ind_maxparen(ind_maxparen, startpos)
!     int		ind_maxparen;
      pos_T	*startpos;
  {
      long	n = (long)startpos->lnum - (long)curwin->w_cursor.lnum;
  
!     if (n > 0 && n < ind_maxparen / 2)
! 	return ind_maxparen - (int)n;
!     return ind_maxparen;
  }
  
  /*
--- 6585,6598 ----
   * looking a few lines further.
   */
      static int
! corr_ind_maxparen(startpos)
      pos_T	*startpos;
  {
      long	n = (long)startpos->lnum - (long)curwin->w_cursor.lnum;
  
!     if (n > 0 && n < curbuf->b_ind_maxparen / 2)
! 	return curbuf->b_ind_maxparen - (int)n;
!     return curbuf->b_ind_maxparen;
  }
  
  /*
***************
*** 6937,6943 ****
  
      curwin->w_cursor.col = 0;
  
!     original_line_islabel = cin_islabel(curbuf->b_ind_maxcomment);  /* XXX */
  
      /*
       * #defines and so on always go at the left when included in 'cinkeys'.
--- 6930,6936 ----
  
      curwin->w_cursor.col = 0;
  
!     original_line_islabel = cin_islabel();  /* XXX */
  
      /*
       * #defines and so on always go at the left when included in 'cinkeys'.
***************
*** 6973,6979 ****
       * comment, try using the 'comments' option.
       */
      else if (!cin_iscomment(theline)
! 	    && (trypos = find_start_comment(curbuf->b_ind_maxcomment)) != NULL)
  	/* XXX */
      {
  	int	lead_start_len = 2;
--- 6966,6972 ----
       * comment, try using the 'comments' option.
       */
      else if (!cin_iscomment(theline)
! 			       && (trypos = ind_find_start_comment()) != NULL)
  	/* XXX */
      {
  	int	lead_start_len = 2;
***************
*** 7126,7136 ****
      /*
       * Are we inside parentheses or braces?
       */						    /* XXX */
!     else if (((trypos = find_match_paren(curbuf->b_ind_maxparen,
! 					    curbuf->b_ind_maxcomment)) != NULL
  		&& curbuf->b_ind_java == 0)
! 	    || (tryposBrace =
! 			   find_start_brace(curbuf->b_ind_maxcomment)) != NULL
  	    || trypos != NULL)
      {
        if (trypos != NULL && tryposBrace != NULL)
--- 7119,7127 ----
      /*
       * Are we inside parentheses or braces?
       */						    /* XXX */
!     else if (((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL
  		&& curbuf->b_ind_java == 0)
! 	    || (tryposBrace = find_start_brace()) != NULL
  	    || trypos != NULL)
      {
        if (trypos != NULL && tryposBrace != NULL)
***************
*** 7170,7177 ****
  		curwin->w_cursor.lnum = lnum;
  
  		/* Skip a comment. XXX */
! 		if ((trypos = find_start_comment(curbuf->b_ind_maxcomment))
! 								      != NULL)
  		{
  		    lnum = trypos->lnum + 1;
  		    continue;
--- 7161,7167 ----
  		curwin->w_cursor.lnum = lnum;
  
  		/* Skip a comment. XXX */
! 		if ((trypos = ind_find_start_comment()) != NULL)
  		{
  		    lnum = trypos->lnum + 1;
  		    continue;
***************
*** 7179,7186 ****
  
  		/* XXX */
  		if ((trypos = find_match_paren(
! 		       corr_ind_maxparen(curbuf->b_ind_maxparen, &cur_curpos),
! 					    curbuf->b_ind_maxcomment)) != NULL
  			&& trypos->lnum == our_paren_pos.lnum
  			&& trypos->col == our_paren_pos.col)
  		{
--- 7169,7175 ----
  
  		/* XXX */
  		if ((trypos = find_match_paren(
! 			corr_ind_maxparen(&cur_curpos))) != NULL
  			&& trypos->lnum == our_paren_pos.lnum
  			&& trypos->col == our_paren_pos.col)
  		{
***************
*** 7223,7230 ****
  		    curwin->w_cursor.lnum = outermost.lnum;
  		    curwin->w_cursor.col = outermost.col;
  
! 		    trypos = find_match_paren(curbuf->b_ind_maxparen,
! 						    curbuf->b_ind_maxcomment);
  		} while (trypos && trypos->lnum == outermost.lnum);
  
  		curwin->w_cursor = cursor_save;
--- 7212,7218 ----
  		    curwin->w_cursor.lnum = outermost.lnum;
  		    curwin->w_cursor.col = outermost.col;
  
! 		    trypos = find_match_paren(curbuf->b_ind_maxparen);
  		} while (trypos && trypos->lnum == outermost.lnum);
  
  		curwin->w_cursor = cursor_save;
***************
*** 7235,7242 ****
  		    cin_is_if_for_while_before_offset(line, &outermost.col);
  	    }
  
! 	    amount = skip_label(our_paren_pos.lnum, &look,
! 						    curbuf->b_ind_maxcomment);
  	    look = skipwhite(look);
  	    if (*look == '(')
  	    {
--- 7223,7229 ----
  		    cin_is_if_for_while_before_offset(line, &outermost.col);
  	    }
  
! 	    amount = skip_label(our_paren_pos.lnum, &look);
  	    look = skipwhite(look);
  	    if (*look == '(')
  	    {
***************
*** 7366,7373 ****
  		{
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
  		    curwin->w_cursor.col = col;
! 		    if (find_match_paren(curbuf->b_ind_maxparen,
! 					    curbuf->b_ind_maxcomment) != NULL)
  			amount += curbuf->b_ind_unclosed2;
  		    else
  		    {
--- 7353,7359 ----
  		{
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
  		    curwin->w_cursor.col = col;
! 		    if (find_match_paren(curbuf->b_ind_maxparen) != NULL)
  			amount += curbuf->b_ind_unclosed2;
  		    else
  		    {
***************
*** 7435,7442 ****
  	     */
  	    lnum = ourscope;
  	    if (find_last_paren(start, '(', ')')
! 		    && (trypos = find_match_paren(curbuf->b_ind_maxparen,
! 					   curbuf->b_ind_maxcomment)) != NULL)
  		lnum = trypos->lnum;
  
  	    /*
--- 7421,7428 ----
  	     */
  	    lnum = ourscope;
  	    if (find_last_paren(start, '(', ')')
! 			&& (trypos = find_match_paren(curbuf->b_ind_maxparen))
! 								      != NULL)
  		lnum = trypos->lnum;
  
  	    /*
***************
*** 7449,7455 ****
  			   && cin_iscase(skipwhite(ml_get_curline()), FALSE)))
  		amount = get_indent();
  	    else
! 		amount = skip_label(lnum, &l, curbuf->b_ind_maxcomment);
  
  	    start_brace = BRACE_AT_END;
  	}
--- 7435,7441 ----
  			   && cin_iscase(skipwhite(ml_get_curline()), FALSE)))
  		amount = get_indent();
  	    else
! 		amount = skip_label(lnum, &l);
  
  	    start_brace = BRACE_AT_END;
  	}
***************
*** 7478,7491 ****
  	    lookfor = LOOKFOR_INITIAL;
  	    if (cin_iselse(theline))
  		lookfor = LOOKFOR_IF;
! 	    else if (cin_iswhileofdo(theline, cur_curpos.lnum,
! 					    curbuf->b_ind_maxparen)) /* XXX */
  		lookfor = LOOKFOR_DO;
  	    if (lookfor != LOOKFOR_INITIAL)
  	    {
  		curwin->w_cursor.lnum = cur_curpos.lnum;
! 		if (find_match(lookfor, ourscope, curbuf->b_ind_maxparen,
! 					      curbuf->b_ind_maxcomment) == OK)
  		{
  		    amount = get_indent();	/* XXX */
  		    goto theend;
--- 7464,7475 ----
  	    lookfor = LOOKFOR_INITIAL;
  	    if (cin_iselse(theline))
  		lookfor = LOOKFOR_IF;
! 	    else if (cin_iswhileofdo(theline, cur_curpos.lnum)) /* XXX */
  		lookfor = LOOKFOR_DO;
  	    if (lookfor != LOOKFOR_INITIAL)
  	    {
  		curwin->w_cursor.lnum = cur_curpos.lnum;
! 		if (find_match(lookfor, ourscope) == OK)
  		{
  		    amount = get_indent();	/* XXX */
  		    goto theend;
***************
*** 7611,7617 ****
  			 * If we're in a comment now, skip to the start of the
  			 * comment.
  			 */
! 			trypos = find_start_comment(curbuf->b_ind_maxcomment);
  			if (trypos != NULL)
  			{
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
--- 7595,7601 ----
  			 * If we're in a comment now, skip to the start of the
  			 * comment.
  			 */
! 			trypos = ind_find_start_comment();
  			if (trypos != NULL)
  			{
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
***************
*** 7636,7644 ****
  			 * (it's a variable declaration).
  			 */
  			if (start_brace != BRACE_IN_COL0
! 				|| !cin_isfuncdecl(&l, curwin->w_cursor.lnum,
! 					     0, curbuf->b_ind_maxparen,
! 						    curbuf->b_ind_maxcomment))
  			{
  			    /* if the line is terminated with another ','
  			     * it is a continued variable initialization.
--- 7620,7626 ----
  			 * (it's a variable declaration).
  			 */
  			if (start_brace != BRACE_IN_COL0
! 			     || !cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0))
  			{
  			    /* if the line is terminated with another ','
  			     * it is a continued variable initialization.
***************
*** 7670,7681 ****
  			    trypos = NULL;
  			    if (find_last_paren(l, '(', ')'))
  				trypos = find_match_paren(
! 						curbuf->b_ind_maxparen,
! 						curbuf->b_ind_maxcomment);
  
  			    if (trypos == NULL && find_last_paren(l, '{', '}'))
! 				trypos = find_start_brace(
! 						    curbuf->b_ind_maxcomment);
  
  			    if (trypos != NULL)
  			    {
--- 7652,7661 ----
  			    trypos = NULL;
  			    if (find_last_paren(l, '(', ')'))
  				trypos = find_match_paren(
! 						      curbuf->b_ind_maxparen);
  
  			    if (trypos == NULL && find_last_paren(l, '{', '}'))
! 				trypos = find_start_brace();
  
  			    if (trypos != NULL)
  			    {
***************
*** 7733,7740 ****
  
  			    /* If we're in a comment now, skip to the start of
  			     * the comment. */
! 			    trypos = find_start_comment(
! 						    curbuf->b_ind_maxcomment);
  			    if (trypos != NULL)
  			    {
  				curwin->w_cursor.lnum = trypos->lnum + 1;
--- 7713,7719 ----
  
  			    /* If we're in a comment now, skip to the start of
  			     * the comment. */
! 			    trypos = ind_find_start_comment();
  			    if (trypos != NULL)
  			    {
  				curwin->w_cursor.lnum = trypos->lnum + 1;
***************
*** 7764,7771 ****
  		/*
  		 * If we're in a comment now, skip to the start of the comment.
  		 */					    /* XXX */
! 		if ((trypos = find_start_comment(curbuf->b_ind_maxcomment))
! 								      != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
  		    curwin->w_cursor.col = 0;
--- 7743,7749 ----
  		/*
  		 * If we're in a comment now, skip to the start of the comment.
  		 */					    /* XXX */
! 		if ((trypos = ind_find_start_comment()) != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
  		    curwin->w_cursor.col = 0;
***************
*** 7819,7826 ****
  			 * Check that this case label is not for another
  			 * switch()
  			 */				    /* XXX */
! 			if ((trypos = find_start_brace(
! 					    curbuf->b_ind_maxcomment)) == NULL
  						  || trypos->lnum == ourscope)
  			{
  			    amount = get_indent();	/* XXX */
--- 7797,7803 ----
  			 * Check that this case label is not for another
  			 * switch()
  			 */				    /* XXX */
! 			if ((trypos = find_start_brace()) == NULL
  						  || trypos->lnum == ourscope)
  			{
  			    amount = get_indent();	/* XXX */
***************
*** 7894,7901 ****
  		 */
  		if (lookfor == LOOKFOR_CASE || lookfor == LOOKFOR_SCOPEDECL)
  		{
! 		    if (find_last_paren(l, '{', '}') && (trypos =
! 			  find_start_brace(curbuf->b_ind_maxcomment)) != NULL)
  		    {
  			curwin->w_cursor.lnum = trypos->lnum + 1;
  			curwin->w_cursor.col = 0;
--- 7871,7878 ----
  		 */
  		if (lookfor == LOOKFOR_CASE || lookfor == LOOKFOR_SCOPEDECL)
  		{
! 		    if (find_last_paren(l, '{', '}')
! 				     && (trypos = find_start_brace()) != NULL)
  		    {
  			curwin->w_cursor.lnum = trypos->lnum + 1;
  			curwin->w_cursor.col = 0;
***************
*** 7906,7912 ****
  		/*
  		 * Ignore jump labels with nothing after them.
  		 */
! 		if (!curbuf->b_ind_js && cin_islabel(curbuf->b_ind_maxcomment))
  		{
  		    l = after_label(ml_get_curline());
  		    if (l == NULL || cin_nocode(l))
--- 7883,7889 ----
  		/*
  		 * Ignore jump labels with nothing after them.
  		 */
! 		if (!curbuf->b_ind_js && cin_islabel())
  		{
  		    l = after_label(ml_get_curline());
  		    if (l == NULL || cin_nocode(l))
***************
*** 7952,7961 ****
  		    }
  		    else
  								     /* XXX */
! 			amount = get_baseclass_amount(col,
! 						   curbuf->b_ind_maxparen,
! 						   curbuf->b_ind_maxcomment,
! 						   curbuf->b_ind_cpp_baseclass);
  		    break;
  		}
  		else if (lookfor == LOOKFOR_CPP_BASECLASS)
--- 7929,7935 ----
  		    }
  		    else
  								     /* XXX */
! 			amount = get_baseclass_amount(col);
  		    break;
  		}
  		else if (lookfor == LOOKFOR_CPP_BASECLASS)
***************
*** 7997,8005 ****
  		     * matching it will take us back to the start of the line.
  		     */
  		    (void)find_last_paren(l, '(', ')');
! 		    trypos = find_match_paren(
! 				 corr_ind_maxparen(curbuf->b_ind_maxparen,
! 				      &cur_curpos), curbuf->b_ind_maxcomment);
  
  		    /*
  		     * If we are looking for ',', we also look for matching
--- 7971,7977 ----
  		     * matching it will take us back to the start of the line.
  		     */
  		    (void)find_last_paren(l, '(', ')');
! 		    trypos = find_match_paren(corr_ind_maxparen(&cur_curpos));
  
  		    /*
  		     * If we are looking for ',', we also look for matching
***************
*** 8007,8013 ****
  		     */
  		    if (trypos == NULL && terminated == ','
  					      && find_last_paren(l, '{', '}'))
! 			trypos = find_start_brace(curbuf->b_ind_maxcomment);
  
  		    if (trypos != NULL)
  		    {
--- 7979,7985 ----
  		     */
  		    if (trypos == NULL && terminated == ','
  					      && find_last_paren(l, '{', '}'))
! 			trypos = find_start_brace();
  
  		    if (trypos != NULL)
  		    {
***************
*** 8051,8058 ****
  		     * ignoring any jump label.	    XXX
  		     */
  		    if (!curbuf->b_ind_js)
! 			cur_amount = skip_label(curwin->w_cursor.lnum,
! 						&l, curbuf->b_ind_maxcomment);
  		    else
  			cur_amount = get_indent();
  		    /*
--- 8023,8029 ----
  		     * ignoring any jump label.	    XXX
  		     */
  		    if (!curbuf->b_ind_js)
! 			cur_amount = skip_label(curwin->w_cursor.lnum, &l);
  		    else
  			cur_amount = get_indent();
  		    /*
***************
*** 8162,8172 ****
  				curwin->w_cursor.col =
  					  (colnr_T)(l - ml_get_curline()) + 1;
  
! 			    if ((trypos = find_start_brace(
! 					    curbuf->b_ind_maxcomment)) == NULL
! 				    || find_match(LOOKFOR_IF, trypos->lnum,
! 					    curbuf->b_ind_maxparen,
! 					    curbuf->b_ind_maxcomment) == FAIL)
  				break;
  			}
  		    }
--- 8133,8141 ----
  				curwin->w_cursor.col =
  					  (colnr_T)(l - ml_get_curline()) + 1;
  
! 			    if ((trypos = find_start_brace()) == NULL
! 				       || find_match(LOOKFOR_IF, trypos->lnum)
! 								      == FAIL)
  				break;
  			}
  		    }
***************
*** 8261,8268 ****
  		 * If so: Ignore until the matching "do".
  		 */
  							/* XXX */
! 		else if (cin_iswhileofdo_end(terminated, curbuf->b_ind_maxparen,
! 						    curbuf->b_ind_maxcomment))
  		{
  		    /*
  		     * Found an unterminated line after a while ();, line up
--- 8230,8236 ----
  		 * If so: Ignore until the matching "do".
  		 */
  							/* XXX */
! 		else if (cin_iswhileofdo_end(terminated))
  		{
  		    /*
  		     * Found an unterminated line after a while ();, line up
***************
*** 8380,8387 ****
  			l = ml_get_curline();
  			if (find_last_paren(l, '(', ')')
  				&& (trypos = find_match_paren(
! 					   curbuf->b_ind_maxparen,
! 					   curbuf->b_ind_maxcomment)) != NULL)
  			{
  			    /*
  			     * Check if we are on a case label now.  This is
--- 8348,8354 ----
  			l = ml_get_curline();
  			if (find_last_paren(l, '(', ')')
  				&& (trypos = find_match_paren(
! 					   curbuf->b_ind_maxparen)) != NULL)
  			{
  			    /*
  			     * Check if we are on a case label now.  This is
***************
*** 8415,8422 ****
  			 * Get indent and pointer to text for current line,
  			 * ignoring any jump label.
  			 */
! 			amount = skip_label(curwin->w_cursor.lnum,
! 						&l, curbuf->b_ind_maxcomment);
  
  			if (theline[0] == '{')
  			    amount += curbuf->b_ind_open_extra;
--- 8382,8388 ----
  			 * Get indent and pointer to text for current line,
  			 * ignoring any jump label.
  			 */
! 			amount = skip_label(curwin->w_cursor.lnum, &l);
  
  			if (theline[0] == '{')
  			    amount += curbuf->b_ind_open_extra;
***************
*** 8439,8449 ****
  				&& cin_iselse(l)
  				&& whilelevel == 0)
  			{
! 			    if ((trypos = find_start_brace(
! 					    curbuf->b_ind_maxcomment)) == NULL
! 				    || find_match(LOOKFOR_IF, trypos->lnum,
! 					    curbuf->b_ind_maxparen,
! 					    curbuf->b_ind_maxcomment) == FAIL)
  				break;
  			    continue;
  			}
--- 8405,8413 ----
  				&& cin_iselse(l)
  				&& whilelevel == 0)
  			{
! 			    if ((trypos = find_start_brace()) == NULL
! 				       || find_match(LOOKFOR_IF, trypos->lnum)
! 								      == FAIL)
  				break;
  			    continue;
  			}
***************
*** 8453,8461 ****
  			 * that block.
  			 */
  			l = ml_get_curline();
! 			if (find_last_paren(l, '{', '}')
! 				&& (trypos = find_start_brace(
! 				 curbuf->b_ind_maxcomment)) != NULL) /* XXX */
  			{
  			    curwin->w_cursor = *trypos;
  			    /* if not "else {" check for terminated again */
--- 8417,8424 ----
  			 * that block.
  			 */
  			l = ml_get_curline();
! 			if (find_last_paren(l, '{', '}') /* XXX */
! 				     && (trypos = find_start_brace()) != NULL)
  			{
  			    curwin->w_cursor = *trypos;
  			    /* if not "else {" check for terminated again */
***************
*** 8516,8524 ****
  		&& !cin_ends_in(theline, (char_u *)":", NULL)
  		&& !cin_ends_in(theline, (char_u *)",", NULL)
  		&& cin_isfuncdecl(NULL, cur_curpos.lnum + 1,
! 				  cur_curpos.lnum + 1,
! 				  curbuf->b_ind_maxparen,
! 				  curbuf->b_ind_maxcomment)
  		&& !cin_isterminated(theline, FALSE, TRUE))
  	{
  	    amount = curbuf->b_ind_func_type;
--- 8479,8485 ----
  		&& !cin_ends_in(theline, (char_u *)":", NULL)
  		&& !cin_ends_in(theline, (char_u *)",", NULL)
  		&& cin_isfuncdecl(NULL, cur_curpos.lnum + 1,
! 				  cur_curpos.lnum + 1)
  		&& !cin_isterminated(theline, FALSE, TRUE))
  	{
  	    amount = curbuf->b_ind_func_type;
***************
*** 8540,8547 ****
  		/*
  		 * If we're in a comment now, skip to the start of the comment.
  		 */						/* XXX */
! 		if ((trypos = find_start_comment(
! 					   curbuf->b_ind_maxcomment)) != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
  		    curwin->w_cursor.col = 0;
--- 8501,8507 ----
  		/*
  		 * If we're in a comment now, skip to the start of the comment.
  		 */						/* XXX */
! 		if ((trypos = ind_find_start_comment()) != NULL)
  		{
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
  		    curwin->w_cursor.col = 0;
***************
*** 8561,8569 ****
  		if (n)
  		{
  								     /* XXX */
! 		    amount = get_baseclass_amount(col, curbuf->b_ind_maxparen,
! 					   curbuf->b_ind_maxcomment,
! 					   curbuf->b_ind_cpp_baseclass);
  		    break;
  		}
  
--- 8521,8527 ----
  		if (n)
  		{
  								     /* XXX */
! 		    amount = get_baseclass_amount(col);
  		    break;
  		}
  
***************
*** 8595,8602 ****
  		    /* take us back to opening paren */
  		    if (find_last_paren(l, '(', ')')
  			    && (trypos = find_match_paren(
! 					   curbuf->b_ind_maxparen,
! 					   curbuf->b_ind_maxcomment)) != NULL)
  			curwin->w_cursor = *trypos;
  
  		    /* For a line ending in ',' that is a continuation line go
--- 8553,8559 ----
  		    /* take us back to opening paren */
  		    if (find_last_paren(l, '(', ')')
  			    && (trypos = find_match_paren(
! 					     curbuf->b_ind_maxparen)) != NULL)
  			curwin->w_cursor = *trypos;
  
  		    /* For a line ending in ',' that is a continuation line go
***************
*** 8627,8635 ****
  		 * If the line looks like a function declaration, and we're
  		 * not in a comment, put it the left margin.
  		 */
! 		if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0,
! 				   curbuf->b_ind_maxparen,
! 				   curbuf->b_ind_maxcomment))  /* XXX */
  		    break;
  		l = ml_get_curline();
  
--- 8584,8590 ----
  		 * If the line looks like a function declaration, and we're
  		 * not in a comment, put it the left margin.
  		 */
! 		if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0))  /* XXX */
  		    break;
  		l = ml_get_curline();
  
***************
*** 8677,8685 ****
  		 * line (and the ones that follow) needs to be indented as
  		 * parameters.
  		 */
! 		if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0,
! 				   curbuf->b_ind_maxparen,
! 				   curbuf->b_ind_maxcomment))
  		{
  		    amount = curbuf->b_ind_param;
  		    break;
--- 8632,8638 ----
  		 * line (and the ones that follow) needs to be indented as
  		 * parameters.
  		 */
! 		if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0))
  		{
  		    amount = curbuf->b_ind_param;
  		    break;
***************
*** 8710,8717 ****
  		 */
  		find_last_paren(l, '(', ')');
  
! 		if ((trypos = find_match_paren(curbuf->b_ind_maxparen,
! 					   curbuf->b_ind_maxcomment)) != NULL)
  		    curwin->w_cursor = *trypos;
  		amount = get_indent();	    /* XXX */
  		break;
--- 8663,8669 ----
  		 */
  		find_last_paren(l, '(', ')');
  
! 		if ((trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
  		    curwin->w_cursor = *trypos;
  		amount = get_indent();	    /* XXX */
  		break;
***************
*** 8754,8764 ****
  }
  
      static int
! find_match(lookfor, ourscope, ind_maxparen, ind_maxcomment)
      int		lookfor;
      linenr_T	ourscope;
-     int		ind_maxparen;
-     int		ind_maxcomment;
  {
      char_u	*look;
      pos_T	*theirscope;
--- 8706,8714 ----
  }
  
      static int
! find_match(lookfor, ourscope)
      int		lookfor;
      linenr_T	ourscope;
  {
      char_u	*look;
      pos_T	*theirscope;
***************
*** 8788,8800 ****
  	if (cin_iselse(look)
  		|| cin_isif(look)
  		|| cin_isdo(look)			    /* XXX */
! 		|| cin_iswhileofdo(look, curwin->w_cursor.lnum, ind_maxparen))
  	{
  	    /*
  	     * if we've gone outside the braces entirely,
  	     * we must be out of scope...
  	     */
! 	    theirscope = find_start_brace(ind_maxcomment);  /* XXX */
  	    if (theirscope == NULL)
  		break;
  
--- 8738,8750 ----
  	if (cin_iselse(look)
  		|| cin_isif(look)
  		|| cin_isdo(look)			    /* XXX */
! 		|| cin_iswhileofdo(look, curwin->w_cursor.lnum))
  	{
  	    /*
  	     * if we've gone outside the braces entirely,
  	     * we must be out of scope...
  	     */
! 	    theirscope = find_start_brace();  /* XXX */
  	    if (theirscope == NULL)
  		break;
  
***************
*** 8832,8838 ****
  	     * if it was a "while" then we need to go back to
  	     * another "do", so increment whilelevel.  XXX
  	     */
! 	    if (cin_iswhileofdo(look, curwin->w_cursor.lnum, ind_maxparen))
  	    {
  		++whilelevel;
  		continue;
--- 8782,8788 ----
  	     * if it was a "while" then we need to go back to
  	     * another "do", so increment whilelevel.  XXX
  	     */
! 	    if (cin_iswhileofdo(look, curwin->w_cursor.lnum))
  	    {
  		++whilelevel;
  		continue;
*** ../vim-7.4.070/src/proto/misc1.pro	2013-11-05 07:12:59.000000000 +0100
--- src/proto/misc1.pro	2013-11-06 03:19:45.000000000 +0100
***************
*** 81,87 ****
  char_u *FullName_save __ARGS((char_u *fname, int force));
  pos_T *find_start_comment __ARGS((int ind_maxcomment));
  void do_c_expr_indent __ARGS((void));
! int cin_islabel __ARGS((int ind_maxcomment));
  int cin_iscase __ARGS((char_u *s, int strict));
  int cin_isscopedecl __ARGS((char_u *s));
  void parse_cino __ARGS((buf_T *buf));
--- 81,87 ----
  char_u *FullName_save __ARGS((char_u *fname, int force));
  pos_T *find_start_comment __ARGS((int ind_maxcomment));
  void do_c_expr_indent __ARGS((void));
! int cin_islabel __ARGS((void));
  int cin_iscase __ARGS((char_u *s, int strict));
  int cin_isscopedecl __ARGS((char_u *s));
  void parse_cino __ARGS((buf_T *buf));
*** ../vim-7.4.070/src/version.c	2013-11-05 17:40:47.000000000 +0100
--- src/version.c	2013-11-06 03:43:44.000000000 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     71,
  /**/

-- 
A law to reduce crime states: "It is mandatory for a motorist with criminal
intentions to stop at the city limits and telephone the chief of police as he
is entering the town.
		[real standing law in Washington, United States of America]

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
