Blame SOURCES/7.4.071

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