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