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