jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.071

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