Karsten Hopp 1c310d
To: vim_dev@googlegroups.com
Karsten Hopp 1c310d
Subject: Patch 7.4.069
Karsten Hopp 1c310d
Fcc: outbox
Karsten Hopp 1c310d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1c310d
Mime-Version: 1.0
Karsten Hopp 1c310d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 1c310d
Content-Transfer-Encoding: 8bit
Karsten Hopp 1c310d
------------
Karsten Hopp 1c310d
Karsten Hopp 1c310d
Patch 7.4.069
Karsten Hopp 1c310d
Problem:    Cannot right shift lines starting with #.
Karsten Hopp 1c310d
Solution:   Allow the right shift when 'cino' contains #N with N > 0.
Karsten Hopp 1c310d
            (Christian Brabandt)
Karsten Hopp 1c310d
            Refactor parsing 'cino', store the values in the buffer.
Karsten Hopp 1c310d
Files:      runtime/doc/indent.txt, src/buffer.c, src/edit.c, src/eval.c,
Karsten Hopp 1c310d
            src/ex_getln.c, src/fold.c, src/misc1.c, src/ops.c,
Karsten Hopp 1c310d
            src/proto/misc1.pro, src/proto/option.pro, src/structs.h,
Karsten Hopp 1c310d
            src/option.c
Karsten Hopp 1c310d
Karsten Hopp 1c310d
Karsten Hopp 1c310d
*** ../vim-7.4.068/runtime/doc/indent.txt	2013-08-10 13:24:56.000000000 +0200
Karsten Hopp 1c310d
--- runtime/doc/indent.txt	2013-11-05 07:10:56.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 545,554 ****
Karsten Hopp 1c310d
  	      (default 70 lines).
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  								*cino-#*
Karsten Hopp 1c310d
! 	#N    When N is non-zero recognize shell/Perl comments, starting with
Karsten Hopp 1c310d
! 	      '#'.  Default N is zero: don't recognize '#' comments.  Note
Karsten Hopp 1c310d
! 	      that lines starting with # will still be seen as preprocessor
Karsten Hopp 1c310d
! 	      lines.
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  The defaults, spelled out in full, are:
Karsten Hopp 1c310d
--- 545,556 ----
Karsten Hopp 1c310d
  	      (default 70 lines).
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  								*cino-#*
Karsten Hopp 1c310d
! 	#N    When N is non-zero recognize shell/Perl comments starting with
Karsten Hopp 1c310d
! 	      '#', do not recognize preprocessor lines; allow right-shifting
Karsten Hopp 1c310d
! 	      lines that start with "#".
Karsten Hopp 1c310d
! 	      When N is zero (default): don't recognize '#' comments, do
Karsten Hopp 1c310d
! 	      recognize preprocessor lines; right-shifting lines that start
Karsten Hopp 1c310d
! 	      with "#" does not work.
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  The defaults, spelled out in full, are:
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 556,562 ****
Karsten Hopp 1c310d
  			c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  Vim puts a line in column 1 if:
Karsten Hopp 1c310d
! - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
Karsten Hopp 1c310d
  - It starts with a label (a keyword followed by ':', other than "case" and
Karsten Hopp 1c310d
    "default") and 'cinoptions' does not contain an 'L' entry with a positive
Karsten Hopp 1c310d
    value.
Karsten Hopp 1c310d
--- 558,564 ----
Karsten Hopp 1c310d
  			c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  Vim puts a line in column 1 if:
Karsten Hopp 1c310d
! - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#0'.
Karsten Hopp 1c310d
  - It starts with a label (a keyword followed by ':', other than "case" and
Karsten Hopp 1c310d
    "default") and 'cinoptions' does not contain an 'L' entry with a positive
Karsten Hopp 1c310d
    value.
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 581,588 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  Clojure indentation differs somewhat from traditional Lisps, due in part to
Karsten Hopp 1c310d
  the use of square and curly brackets, and otherwise by community convention.
Karsten Hopp 1c310d
! These conventions are not always universally followed, so the Clojure indent
Karsten Hopp 1c310d
! script offers a few configurable options, listed below.
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  If the current vim does not include searchpairpos(), the indent script falls
Karsten Hopp 1c310d
  back to normal 'lisp' indenting, and the following options are ignored.
Karsten Hopp 1c310d
--- 583,590 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  Clojure indentation differs somewhat from traditional Lisps, due in part to
Karsten Hopp 1c310d
  the use of square and curly brackets, and otherwise by community convention.
Karsten Hopp 1c310d
! These conventions are not universally followed, so the Clojure indent script
Karsten Hopp 1c310d
! offers a few configurable options, listed below.
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  If the current vim does not include searchpairpos(), the indent script falls
Karsten Hopp 1c310d
  back to normal 'lisp' indenting, and the following options are ignored.
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/buffer.c	2013-11-02 04:39:34.000000000 +0100
Karsten Hopp 1c310d
--- src/buffer.c	2013-11-05 06:18:54.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 211,217 ****
Karsten Hopp 1c310d
--- 211,220 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /* if first time loading this buffer, init b_chartab[] */
Karsten Hopp 1c310d
      if (curbuf->b_flags & BF_NEVERLOADED)
Karsten Hopp 1c310d
+     {
Karsten Hopp 1c310d
  	(void)buf_init_chartab(curbuf, FALSE);
Karsten Hopp 1c310d
+ 	parse_cino(curbuf);
Karsten Hopp 1c310d
+     }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * Set/reset the Changed flag first, autocmds may change the buffer.
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/edit.c	2013-11-04 04:20:28.000000000 +0100
Karsten Hopp 1c310d
--- src/edit.c	2013-11-05 06:12:45.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8958,8964 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    *inserted_space_p = FALSE;
Karsten Hopp 1c310d
  	    if (p_sta && in_indent)
Karsten Hopp 1c310d
! 		ts = (int)get_sw_value();
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  		ts = (int)get_sts_value();
Karsten Hopp 1c310d
  	    /* Compute the virtual column where we want to be.  Since
Karsten Hopp 1c310d
--- 8958,8964 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    *inserted_space_p = FALSE;
Karsten Hopp 1c310d
  	    if (p_sta && in_indent)
Karsten Hopp 1c310d
! 		ts = (int)get_sw_value(curbuf);
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  		ts = (int)get_sts_value();
Karsten Hopp 1c310d
  	    /* Compute the virtual column where we want to be.  Since
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 9647,9653 ****
Karsten Hopp 1c310d
       * When nothing special, insert TAB like a normal character
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      if (!curbuf->b_p_et
Karsten Hopp 1c310d
! 	    && !(p_sta && ind && curbuf->b_p_ts != get_sw_value())
Karsten Hopp 1c310d
  	    && get_sts_value() == 0)
Karsten Hopp 1c310d
  	return TRUE;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 9647,9653 ----
Karsten Hopp 1c310d
       * When nothing special, insert TAB like a normal character
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      if (!curbuf->b_p_et
Karsten Hopp 1c310d
! 	    && !(p_sta && ind && curbuf->b_p_ts != get_sw_value(curbuf))
Karsten Hopp 1c310d
  	    && get_sts_value() == 0)
Karsten Hopp 1c310d
  	return TRUE;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 9663,9669 ****
Karsten Hopp 1c310d
      AppendToRedobuff((char_u *)"\t");
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      if (p_sta && ind)		/* insert tab in indent, use 'shiftwidth' */
Karsten Hopp 1c310d
! 	temp = (int)get_sw_value();
Karsten Hopp 1c310d
      else if (curbuf->b_p_sts != 0) /* use 'softtabstop' when set */
Karsten Hopp 1c310d
  	temp = (int)get_sts_value();
Karsten Hopp 1c310d
      else			/* otherwise use 'tabstop' */
Karsten Hopp 1c310d
--- 9663,9669 ----
Karsten Hopp 1c310d
      AppendToRedobuff((char_u *)"\t");
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      if (p_sta && ind)		/* insert tab in indent, use 'shiftwidth' */
Karsten Hopp 1c310d
! 	temp = (int)get_sw_value(curbuf);
Karsten Hopp 1c310d
      else if (curbuf->b_p_sts != 0) /* use 'softtabstop' when set */
Karsten Hopp 1c310d
  	temp = (int)get_sts_value();
Karsten Hopp 1c310d
      else			/* otherwise use 'tabstop' */
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/eval.c	2013-11-02 23:29:17.000000000 +0100
Karsten Hopp 1c310d
--- src/eval.c	2013-11-05 06:12:49.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 16934,16940 ****
Karsten Hopp 1c310d
      typval_T	*argvars UNUSED;
Karsten Hopp 1c310d
      typval_T	*rettv;
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     rettv->vval.v_number = get_sw_value();
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
--- 16934,16940 ----
Karsten Hopp 1c310d
      typval_T	*argvars UNUSED;
Karsten Hopp 1c310d
      typval_T	*rettv;
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     rettv->vval.v_number = get_sw_value(curbuf);
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/ex_getln.c	2013-07-05 19:44:21.000000000 +0200
Karsten Hopp 1c310d
--- src/ex_getln.c	2013-11-05 06:12:57.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 2280,2286 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (c1 == Ctrl_T)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		long        sw = get_sw_value();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		p = (char_u *)line_ga.ga_data;
Karsten Hopp 1c310d
  		p[line_ga.ga_len] = NUL;
Karsten Hopp 1c310d
--- 2280,2286 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (c1 == Ctrl_T)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		long        sw = get_sw_value(curbuf);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		p = (char_u *)line_ga.ga_data;
Karsten Hopp 1c310d
  		p[line_ga.ga_len] = NUL;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 2337,2343 ****
Karsten Hopp 1c310d
  		    p[line_ga.ga_len] = NUL;
Karsten Hopp 1c310d
  		    indent = get_indent_str(p, 8);
Karsten Hopp 1c310d
  		    --indent;
Karsten Hopp 1c310d
! 		    indent -= indent % get_sw_value();
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		while (get_indent_str(p, 8) > indent)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
--- 2337,2343 ----
Karsten Hopp 1c310d
  		    p[line_ga.ga_len] = NUL;
Karsten Hopp 1c310d
  		    indent = get_indent_str(p, 8);
Karsten Hopp 1c310d
  		    --indent;
Karsten Hopp 1c310d
! 		    indent -= indent % get_sw_value(curbuf);
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		while (get_indent_str(p, 8) > indent)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 4178,4184 ****
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
   * Prepare a string for expansion.
Karsten Hopp 1c310d
   * When expanding file names: The string will be used with expand_wildcards().
Karsten Hopp 1c310d
!  * Copy the file name into allocated memory and add a '*' at the end.
Karsten Hopp 1c310d
   * When expanding other names: The string will be used with regcomp().  Copy
Karsten Hopp 1c310d
   * the name into allocated memory and prepend "^".
Karsten Hopp 1c310d
   */
Karsten Hopp 1c310d
--- 4178,4184 ----
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
   * Prepare a string for expansion.
Karsten Hopp 1c310d
   * When expanding file names: The string will be used with expand_wildcards().
Karsten Hopp 1c310d
!  * Copy "fname[len]" into allocated memory and add a '*' at the end.
Karsten Hopp 1c310d
   * When expanding other names: The string will be used with regcomp().  Copy
Karsten Hopp 1c310d
   * the name into allocated memory and prepend "^".
Karsten Hopp 1c310d
   */
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/fold.c	2013-06-15 16:57:24.000000000 +0200
Karsten Hopp 1c310d
--- src/fold.c	2013-11-05 06:13:03.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 3052,3058 ****
Karsten Hopp 1c310d
  	    flp->lvl = -1;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
      else
Karsten Hopp 1c310d
! 	flp->lvl = get_indent_buf(buf, lnum) / get_sw_value();
Karsten Hopp 1c310d
      if (flp->lvl > flp->wp->w_p_fdn)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	flp->lvl = flp->wp->w_p_fdn;
Karsten Hopp 1c310d
--- 3052,3058 ----
Karsten Hopp 1c310d
  	    flp->lvl = -1;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
      else
Karsten Hopp 1c310d
! 	flp->lvl = get_indent_buf(buf, lnum) / get_sw_value(curbuf);
Karsten Hopp 1c310d
      if (flp->lvl > flp->wp->w_p_fdn)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	flp->lvl = flp->wp->w_p_fdn;
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/misc1.c	2013-11-04 02:53:46.000000000 +0100
Karsten Hopp 1c310d
--- src/misc1.c	2013-11-05 06:45:15.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 1405,1411 ****
Karsten Hopp 1c310d
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 1c310d
  	if (did_si)
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    int        sw = (int)get_sw_value();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (p_sr)
Karsten Hopp 1c310d
  		newindent -= newindent % sw;
Karsten Hopp 1c310d
--- 1405,1411 ----
Karsten Hopp 1c310d
  #ifdef FEAT_SMARTINDENT
Karsten Hopp 1c310d
  	if (did_si)
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    int        sw = (int)get_sw_value(curbuf);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (p_sr)
Karsten Hopp 1c310d
  		newindent -= newindent % sw;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 5342,5349 ****
Karsten Hopp 1c310d
  static int	find_match __ARGS((int lookfor, linenr_T ourscope, int ind_maxparen, int ind_maxcomment));
Karsten Hopp 1c310d
  static int	cin_is_cpp_namespace __ARGS((char_u *));
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
- static int	ind_hash_comment = 0;   /* # starts a comment */
Karsten Hopp 1c310d
- 
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
   * Skip over white space and C comments within the line.
Karsten Hopp 1c310d
   * Also skip over Perl/shell comments if desired.
Karsten Hopp 1c310d
--- 5342,5347 ----
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 5360,5366 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/* Perl/shell # comment comment continues until eol.  Require a space
Karsten Hopp 1c310d
  	 * before # to avoid recognizing $#array. */
Karsten Hopp 1c310d
! 	if (ind_hash_comment != 0 && s != prev_s && *s == '#')
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
  	    s += STRLEN(s);
Karsten Hopp 1c310d
  	    break;
Karsten Hopp 1c310d
--- 5358,5364 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/* Perl/shell # comment comment continues until eol.  Require a space
Karsten Hopp 1c310d
  	 * before # to avoid recognizing $#array. */
Karsten Hopp 1c310d
! 	if (curbuf->b_ind_hash_comment != 0 && s != prev_s && *s == '#')
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
  	    s += STRLEN(s);
Karsten Hopp 1c310d
  	    break;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 6639,6839 ****
Karsten Hopp 1c310d
      return retval;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     int
Karsten Hopp 1c310d
! get_c_indent()
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     int sw = (int)get_sw_value();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
!      * spaces from a block's opening brace the prevailing indent for that
Karsten Hopp 1c310d
!      * block should be
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     int ind_level = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the edge of the line an open brace that's at the end of a
Karsten Hopp 1c310d
!      * line is imagined to be.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_open_imag = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the prevailing indent for a line that is not preceded by
Karsten Hopp 1c310d
!      * an opening brace.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_no_brace = 0;
Karsten Hopp 1c310d
! 
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * column where the first { of a function should be located }
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_first_open = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the prevailing indent a leftmost open brace should be
Karsten Hopp 1c310d
!      * located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_open_extra = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the matching open brace (real location for one at the left
Karsten Hopp 1c310d
       * edge; imaginary location from one that ends a line) the matching close
Karsten Hopp 1c310d
!      * brace should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_close_extra = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the edge of the line an open brace sitting in the leftmost
Karsten Hopp 1c310d
!      * column is imagined to be
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_open_left_imag = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * Spaces jump labels should be shifted to the left if N is non-negative,
Karsten Hopp 1c310d
!      * otherwise the jump label will be put to column 1.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_jump_label = -1;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the switch() indent a "case xx" label should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_case = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the "case xx:" code after a switch() should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_case_code = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * lineup break at end of case in switch() with case label
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_case_break = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the class declaration indent a scope declaration label
Karsten Hopp 1c310d
!      * should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_scopedecl = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the scope declaration label code should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_scopedecl_code = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * amount K&R-style parameters should be indented
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_param = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * amount a function type spec should be indented
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_func_type = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * amount a cpp base class declaration or constructor initialization
Karsten Hopp 1c310d
!      * should be indented
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_cpp_baseclass = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * additional spaces beyond the prevailing indent a continuation line
Karsten Hopp 1c310d
!      * should be located
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_continuation = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the indent of the line with an unclosed parentheses
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_unclosed = sw * 2;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the indent of the line with an unclosed parentheses, which
Karsten Hopp 1c310d
!      * itself is also unclosed
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_unclosed2 = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * suppress ignoring spaces from the indent of a line starting with an
Karsten Hopp 1c310d
!      * unclosed parentheses.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_unclosed_noignore = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * If the opening paren is the last nonwhite character on the line, and
Karsten Hopp 1c310d
!      * ind_unclosed_wrapped is nonzero, use this indent relative to the outer
Karsten Hopp 1c310d
!      * context (for very long lines).
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_unclosed_wrapped = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * suppress ignoring white space when lining up with the character after
Karsten Hopp 1c310d
!      * an unclosed parentheses.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_unclosed_whiteok = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * indent a closing parentheses under the line start of the matching
Karsten Hopp 1c310d
!      * opening parentheses.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_matching_paren = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * indent a closing parentheses under the previous line.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_paren_prev = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * Extra indent for comments.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_comment = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * spaces from the comment opener when there is nothing after it.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_in_comment = 3;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * boolean: if non-zero, use ind_in_comment even if there is something
Karsten Hopp 1c310d
!      * after the comment opener.
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_in_comment2 = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * max lines to search for an open paren
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_maxparen = 20;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * max lines to search for an open comment
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_maxcomment = 70;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * handle braces for java code
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int	ind_java = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * not to confuse JS object properties with labels
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_js = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * handle blocked cases correctly
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_keep_case_label = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * handle C++ namespace
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_cpp_namespace = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /*
Karsten Hopp 1c310d
!      * handle continuation lines containing conditions of if(), for() and
Karsten Hopp 1c310d
!      * while()
Karsten Hopp 1c310d
!      */
Karsten Hopp 1c310d
!     int ind_if_for_while = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      pos_T	cur_curpos;
Karsten Hopp 1c310d
      int		amount;
Karsten Hopp 1c310d
      int		scope_amount;
Karsten Hopp 1c310d
--- 6637,6865 ----
Karsten Hopp 1c310d
      return retval;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! /*
Karsten Hopp 1c310d
!  * Parse 'cinoptions' and set the values in "curbuf".
Karsten Hopp 1c310d
!  * Must be called when 'cinoptions', 'shiftwidth' and/or 'tabstop' changes.
Karsten Hopp 1c310d
!  */
Karsten Hopp 1c310d
!     void
Karsten Hopp 1c310d
! parse_cino(buf)
Karsten Hopp 1c310d
!     buf_T	*buf;
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     char_u	*p;
Karsten Hopp 1c310d
!     char_u	*l;
Karsten Hopp 1c310d
!     char_u	*digits;
Karsten Hopp 1c310d
!     int		n;
Karsten Hopp 1c310d
!     int		divider;
Karsten Hopp 1c310d
!     int		fraction = 0;
Karsten Hopp 1c310d
!     int		sw = (int)get_sw_value(buf);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
!      * Set the default values.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
+     /* Spaces from a block's opening brace the prevailing indent for that
Karsten Hopp 1c310d
+      * block should be. */
Karsten Hopp 1c310d
+     buf->b_ind_level = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the edge of the line an open brace that's at the end of a
Karsten Hopp 1c310d
!      * line is imagined to be. */
Karsten Hopp 1c310d
!     buf->b_ind_open_imag = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the prevailing indent for a line that is not preceded by
Karsten Hopp 1c310d
!      * an opening brace. */
Karsten Hopp 1c310d
!     buf->b_ind_no_brace = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Column where the first { of a function should be located }. */
Karsten Hopp 1c310d
!     buf->b_ind_first_open = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the prevailing indent a leftmost open brace should be
Karsten Hopp 1c310d
!      * located. */
Karsten Hopp 1c310d
!     buf->b_ind_open_extra = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the matching open brace (real location for one at the left
Karsten Hopp 1c310d
       * edge; imaginary location from one that ends a line) the matching close
Karsten Hopp 1c310d
!      * brace should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_close_extra = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the edge of the line an open brace sitting in the leftmost
Karsten Hopp 1c310d
!      * column is imagined to be. */
Karsten Hopp 1c310d
!     buf->b_ind_open_left_imag = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces jump labels should be shifted to the left if N is non-negative,
Karsten Hopp 1c310d
!      * otherwise the jump label will be put to column 1. */
Karsten Hopp 1c310d
!     buf->b_ind_jump_label = -1;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the switch() indent a "case xx" label should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_case = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the "case xx:" code after a switch() should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_case_code = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Lineup break at end of case in switch() with case label. */
Karsten Hopp 1c310d
!     buf->b_ind_case_break = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the class declaration indent a scope declaration label
Karsten Hopp 1c310d
!      * should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_scopedecl = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the scope declaration label code should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_scopedecl_code = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Amount K&R-style parameters should be indented. */
Karsten Hopp 1c310d
!     buf->b_ind_param = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Amount a function type spec should be indented. */
Karsten Hopp 1c310d
!     buf->b_ind_func_type = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Amount a cpp base class declaration or constructor initialization
Karsten Hopp 1c310d
!      * should be indented. */
Karsten Hopp 1c310d
!     buf->b_ind_cpp_baseclass = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* additional spaces beyond the prevailing indent a continuation line
Karsten Hopp 1c310d
!      * should be located. */
Karsten Hopp 1c310d
!     buf->b_ind_continuation = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the indent of the line with an unclosed parentheses. */
Karsten Hopp 1c310d
!     buf->b_ind_unclosed = sw * 2;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the indent of the line with an unclosed parentheses, which
Karsten Hopp 1c310d
!      * itself is also unclosed. */
Karsten Hopp 1c310d
!     buf->b_ind_unclosed2 = sw;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Suppress ignoring spaces from the indent of a line starting with an
Karsten Hopp 1c310d
!      * unclosed parentheses. */
Karsten Hopp 1c310d
!     buf->b_ind_unclosed_noignore = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* If the opening paren is the last nonwhite character on the line, and
Karsten Hopp 1c310d
!      * b_ind_unclosed_wrapped is nonzero, use this indent relative to the outer
Karsten Hopp 1c310d
!      * context (for very long lines). */
Karsten Hopp 1c310d
!     buf->b_ind_unclosed_wrapped = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Suppress ignoring white space when lining up with the character after
Karsten Hopp 1c310d
!      * an unclosed parentheses. */
Karsten Hopp 1c310d
!     buf->b_ind_unclosed_whiteok = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Indent a closing parentheses under the line start of the matching
Karsten Hopp 1c310d
!      * opening parentheses. */
Karsten Hopp 1c310d
!     buf->b_ind_matching_paren = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Indent a closing parentheses under the previous line. */
Karsten Hopp 1c310d
!     buf->b_ind_paren_prev = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Extra indent for comments. */
Karsten Hopp 1c310d
!     buf->b_ind_comment = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Spaces from the comment opener when there is nothing after it. */
Karsten Hopp 1c310d
!     buf->b_ind_in_comment = 3;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Boolean: if non-zero, use b_ind_in_comment even if there is something
Karsten Hopp 1c310d
!      * after the comment opener. */
Karsten Hopp 1c310d
!     buf->b_ind_in_comment2 = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Max lines to search for an open paren. */
Karsten Hopp 1c310d
!     buf->b_ind_maxparen = 20;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Max lines to search for an open comment. */
Karsten Hopp 1c310d
!     buf->b_ind_maxcomment = 70;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Handle braces for java code. */
Karsten Hopp 1c310d
!     buf->b_ind_java = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Not to confuse JS object properties with labels. */
Karsten Hopp 1c310d
!     buf->b_ind_js = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Handle blocked cases correctly. */
Karsten Hopp 1c310d
!     buf->b_ind_keep_case_label = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Handle C++ namespace. */
Karsten Hopp 1c310d
!     buf->b_ind_cpp_namespace = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* Handle continuation lines containing conditions of if(), for() and
Karsten Hopp 1c310d
!      * while(). */
Karsten Hopp 1c310d
!     buf->b_ind_if_for_while = 0;
Karsten Hopp 1c310d
! 
Karsten Hopp 1c310d
!     for (p = buf->b_p_cino; *p; )
Karsten Hopp 1c310d
!     {
Karsten Hopp 1c310d
! 	l = p++;
Karsten Hopp 1c310d
! 	if (*p == '-')
Karsten Hopp 1c310d
! 	    ++p;
Karsten Hopp 1c310d
! 	digits = p;	    /* remember where the digits start */
Karsten Hopp 1c310d
! 	n = getdigits(&p);
Karsten Hopp 1c310d
! 	divider = 0;
Karsten Hopp 1c310d
! 	if (*p == '.')	    /* ".5s" means a fraction */
Karsten Hopp 1c310d
! 	{
Karsten Hopp 1c310d
! 	    fraction = atol((char *)++p);
Karsten Hopp 1c310d
! 	    while (VIM_ISDIGIT(*p))
Karsten Hopp 1c310d
! 	    {
Karsten Hopp 1c310d
! 		++p;
Karsten Hopp 1c310d
! 		if (divider)
Karsten Hopp 1c310d
! 		    divider *= 10;
Karsten Hopp 1c310d
! 		else
Karsten Hopp 1c310d
! 		    divider = 10;
Karsten Hopp 1c310d
! 	    }
Karsten Hopp 1c310d
! 	}
Karsten Hopp 1c310d
! 	if (*p == 's')	    /* "2s" means two times 'shiftwidth' */
Karsten Hopp 1c310d
! 	{
Karsten Hopp 1c310d
! 	    if (p == digits)
Karsten Hopp 1c310d
! 		n = sw;	/* just "s" is one 'shiftwidth' */
Karsten Hopp 1c310d
! 	    else
Karsten Hopp 1c310d
! 	    {
Karsten Hopp 1c310d
! 		n *= sw;
Karsten Hopp 1c310d
! 		if (divider)
Karsten Hopp 1c310d
! 		    n += (sw * fraction + divider / 2) / divider;
Karsten Hopp 1c310d
! 	    }
Karsten Hopp 1c310d
! 	    ++p;
Karsten Hopp 1c310d
! 	}
Karsten Hopp 1c310d
! 	if (l[1] == '-')
Karsten Hopp 1c310d
! 	    n = -n;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
+ 	/* When adding an entry here, also update the default 'cinoptions' in
Karsten Hopp 1c310d
+ 	 * doc/indent.txt, and add explanation for it! */
Karsten Hopp 1c310d
+ 	switch (*l)
Karsten Hopp 1c310d
+ 	{
Karsten Hopp 1c310d
+ 	    case '>': buf->b_ind_level = n; break;
Karsten Hopp 1c310d
+ 	    case 'e': buf->b_ind_open_imag = n; break;
Karsten Hopp 1c310d
+ 	    case 'n': buf->b_ind_no_brace = n; break;
Karsten Hopp 1c310d
+ 	    case 'f': buf->b_ind_first_open = n; break;
Karsten Hopp 1c310d
+ 	    case '{': buf->b_ind_open_extra = n; break;
Karsten Hopp 1c310d
+ 	    case '}': buf->b_ind_close_extra = n; break;
Karsten Hopp 1c310d
+ 	    case '^': buf->b_ind_open_left_imag = n; break;
Karsten Hopp 1c310d
+ 	    case 'L': buf->b_ind_jump_label = n; break;
Karsten Hopp 1c310d
+ 	    case ':': buf->b_ind_case = n; break;
Karsten Hopp 1c310d
+ 	    case '=': buf->b_ind_case_code = n; break;
Karsten Hopp 1c310d
+ 	    case 'b': buf->b_ind_case_break = n; break;
Karsten Hopp 1c310d
+ 	    case 'p': buf->b_ind_param = n; break;
Karsten Hopp 1c310d
+ 	    case 't': buf->b_ind_func_type = n; break;
Karsten Hopp 1c310d
+ 	    case '/': buf->b_ind_comment = n; break;
Karsten Hopp 1c310d
+ 	    case 'c': buf->b_ind_in_comment = n; break;
Karsten Hopp 1c310d
+ 	    case 'C': buf->b_ind_in_comment2 = n; break;
Karsten Hopp 1c310d
+ 	    case 'i': buf->b_ind_cpp_baseclass = n; break;
Karsten Hopp 1c310d
+ 	    case '+': buf->b_ind_continuation = n; break;
Karsten Hopp 1c310d
+ 	    case '(': buf->b_ind_unclosed = n; break;
Karsten Hopp 1c310d
+ 	    case 'u': buf->b_ind_unclosed2 = n; break;
Karsten Hopp 1c310d
+ 	    case 'U': buf->b_ind_unclosed_noignore = n; break;
Karsten Hopp 1c310d
+ 	    case 'W': buf->b_ind_unclosed_wrapped = n; break;
Karsten Hopp 1c310d
+ 	    case 'w': buf->b_ind_unclosed_whiteok = n; break;
Karsten Hopp 1c310d
+ 	    case 'm': buf->b_ind_matching_paren = n; break;
Karsten Hopp 1c310d
+ 	    case 'M': buf->b_ind_paren_prev = n; break;
Karsten Hopp 1c310d
+ 	    case ')': buf->b_ind_maxparen = n; break;
Karsten Hopp 1c310d
+ 	    case '*': buf->b_ind_maxcomment = n; break;
Karsten Hopp 1c310d
+ 	    case 'g': buf->b_ind_scopedecl = n; break;
Karsten Hopp 1c310d
+ 	    case 'h': buf->b_ind_scopedecl_code = n; break;
Karsten Hopp 1c310d
+ 	    case 'j': buf->b_ind_java = n; break;
Karsten Hopp 1c310d
+ 	    case 'J': buf->b_ind_js = n; break;
Karsten Hopp 1c310d
+ 	    case 'l': buf->b_ind_keep_case_label = n; break;
Karsten Hopp 1c310d
+ 	    case '#': buf->b_ind_hash_comment = n; break;
Karsten Hopp 1c310d
+ 	    case 'N': buf->b_ind_cpp_namespace = n; break;
Karsten Hopp 1c310d
+ 	    case 'k': buf->b_ind_if_for_while = n; break;
Karsten Hopp 1c310d
+ 	}
Karsten Hopp 1c310d
+ 	if (*p == ',')
Karsten Hopp 1c310d
+ 	    ++p;
Karsten Hopp 1c310d
+     }
Karsten Hopp 1c310d
+ }
Karsten Hopp 1c310d
+ 
Karsten Hopp 1c310d
+     int
Karsten Hopp 1c310d
+ get_c_indent()
Karsten Hopp 1c310d
+ {
Karsten Hopp 1c310d
      pos_T	cur_curpos;
Karsten Hopp 1c310d
      int		amount;
Karsten Hopp 1c310d
      int		scope_amount;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 6868,6877 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      int		whilelevel;
Karsten Hopp 1c310d
      linenr_T	lnum;
Karsten Hopp 1c310d
-     char_u	*options;
Karsten Hopp 1c310d
-     char_u	*digits;
Karsten Hopp 1c310d
-     int		fraction = 0;	    /* init for GCC */
Karsten Hopp 1c310d
-     int		divider;
Karsten Hopp 1c310d
      int		n;
Karsten Hopp 1c310d
      int		iscase;
Karsten Hopp 1c310d
      int		lookfor_break;
Karsten Hopp 1c310d
--- 6894,6899 ----
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 6880,6962 ****
Karsten Hopp 1c310d
      int		original_line_islabel;
Karsten Hopp 1c310d
      int		added_to_amount = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     for (options = curbuf->b_p_cino; *options; )
Karsten Hopp 1c310d
!     {
Karsten Hopp 1c310d
! 	l = options++;
Karsten Hopp 1c310d
! 	if (*options == '-')
Karsten Hopp 1c310d
! 	    ++options;
Karsten Hopp 1c310d
! 	digits = options;	    /* remember where the digits start */
Karsten Hopp 1c310d
! 	n = getdigits(&options);
Karsten Hopp 1c310d
! 	divider = 0;
Karsten Hopp 1c310d
! 	if (*options == '.')	    /* ".5s" means a fraction */
Karsten Hopp 1c310d
! 	{
Karsten Hopp 1c310d
! 	    fraction = atol((char *)++options);
Karsten Hopp 1c310d
! 	    while (VIM_ISDIGIT(*options))
Karsten Hopp 1c310d
! 	    {
Karsten Hopp 1c310d
! 		++options;
Karsten Hopp 1c310d
! 		if (divider)
Karsten Hopp 1c310d
! 		    divider *= 10;
Karsten Hopp 1c310d
! 		else
Karsten Hopp 1c310d
! 		    divider = 10;
Karsten Hopp 1c310d
! 	    }
Karsten Hopp 1c310d
! 	}
Karsten Hopp 1c310d
! 	if (*options == 's')	    /* "2s" means two times 'shiftwidth' */
Karsten Hopp 1c310d
! 	{
Karsten Hopp 1c310d
! 	    if (options == digits)
Karsten Hopp 1c310d
! 		n = sw;	/* just "s" is one 'shiftwidth' */
Karsten Hopp 1c310d
! 	    else
Karsten Hopp 1c310d
! 	    {
Karsten Hopp 1c310d
! 		n *= sw;
Karsten Hopp 1c310d
! 		if (divider)
Karsten Hopp 1c310d
! 		    n += (sw * fraction + divider / 2) / divider;
Karsten Hopp 1c310d
! 	    }
Karsten Hopp 1c310d
! 	    ++options;
Karsten Hopp 1c310d
! 	}
Karsten Hopp 1c310d
! 	if (l[1] == '-')
Karsten Hopp 1c310d
! 	    n = -n;
Karsten Hopp 1c310d
! 	/* When adding an entry here, also update the default 'cinoptions' in
Karsten Hopp 1c310d
! 	 * doc/indent.txt, and add explanation for it! */
Karsten Hopp 1c310d
! 	switch (*l)
Karsten Hopp 1c310d
! 	{
Karsten Hopp 1c310d
! 	    case '>': ind_level = n; break;
Karsten Hopp 1c310d
! 	    case 'e': ind_open_imag = n; break;
Karsten Hopp 1c310d
! 	    case 'n': ind_no_brace = n; break;
Karsten Hopp 1c310d
! 	    case 'f': ind_first_open = n; break;
Karsten Hopp 1c310d
! 	    case '{': ind_open_extra = n; break;
Karsten Hopp 1c310d
! 	    case '}': ind_close_extra = n; break;
Karsten Hopp 1c310d
! 	    case '^': ind_open_left_imag = n; break;
Karsten Hopp 1c310d
! 	    case 'L': ind_jump_label = n; break;
Karsten Hopp 1c310d
! 	    case ':': ind_case = n; break;
Karsten Hopp 1c310d
! 	    case '=': ind_case_code = n; break;
Karsten Hopp 1c310d
! 	    case 'b': ind_case_break = n; break;
Karsten Hopp 1c310d
! 	    case 'p': ind_param = n; break;
Karsten Hopp 1c310d
! 	    case 't': ind_func_type = n; break;
Karsten Hopp 1c310d
! 	    case '/': ind_comment = n; break;
Karsten Hopp 1c310d
! 	    case 'c': ind_in_comment = n; break;
Karsten Hopp 1c310d
! 	    case 'C': ind_in_comment2 = n; break;
Karsten Hopp 1c310d
! 	    case 'i': ind_cpp_baseclass = n; break;
Karsten Hopp 1c310d
! 	    case '+': ind_continuation = n; break;
Karsten Hopp 1c310d
! 	    case '(': ind_unclosed = n; break;
Karsten Hopp 1c310d
! 	    case 'u': ind_unclosed2 = n; break;
Karsten Hopp 1c310d
! 	    case 'U': ind_unclosed_noignore = n; break;
Karsten Hopp 1c310d
! 	    case 'W': ind_unclosed_wrapped = n; break;
Karsten Hopp 1c310d
! 	    case 'w': ind_unclosed_whiteok = n; break;
Karsten Hopp 1c310d
! 	    case 'm': ind_matching_paren = n; break;
Karsten Hopp 1c310d
! 	    case 'M': ind_paren_prev = n; break;
Karsten Hopp 1c310d
! 	    case ')': ind_maxparen = n; break;
Karsten Hopp 1c310d
! 	    case '*': ind_maxcomment = n; break;
Karsten Hopp 1c310d
! 	    case 'g': ind_scopedecl = n; break;
Karsten Hopp 1c310d
! 	    case 'h': ind_scopedecl_code = n; break;
Karsten Hopp 1c310d
! 	    case 'j': ind_java = n; break;
Karsten Hopp 1c310d
! 	    case 'J': ind_js = n; break;
Karsten Hopp 1c310d
! 	    case 'l': ind_keep_case_label = n; break;
Karsten Hopp 1c310d
! 	    case '#': ind_hash_comment = n; break;
Karsten Hopp 1c310d
! 	    case 'N': ind_cpp_namespace = n; break;
Karsten Hopp 1c310d
! 	    case 'k': ind_if_for_while = n; break;
Karsten Hopp 1c310d
! 	}
Karsten Hopp 1c310d
! 	if (*options == ',')
Karsten Hopp 1c310d
! 	    ++options;
Karsten Hopp 1c310d
!     }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /* remember where the cursor was when we started */
Karsten Hopp 1c310d
      cur_curpos = curwin->w_cursor;
Karsten Hopp 1c310d
--- 6902,6909 ----
Karsten Hopp 1c310d
      int		original_line_islabel;
Karsten Hopp 1c310d
      int		added_to_amount = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     /* make a copy, value is changed below */
Karsten Hopp 1c310d
!     int		ind_continuation = curbuf->b_ind_continuation;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /* remember where the cursor was when we started */
Karsten Hopp 1c310d
      cur_curpos = curwin->w_cursor;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 6990,7011 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     original_line_islabel = cin_islabel(ind_maxcomment);  /* XXX */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * #defines and so on always go at the left when included in 'cinkeys'.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE)))
Karsten Hopp 1c310d
!     {
Karsten Hopp 1c310d
! 	amount = 0;
Karsten Hopp 1c310d
!     }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * Is it a non-case label?	Then that goes at the left margin too unless:
Karsten Hopp 1c310d
       *  - JS flag is set.
Karsten Hopp 1c310d
       *  - 'L' item has a positive value.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
!     else if (original_line_islabel && !ind_js && ind_jump_label < 0)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	amount = 0;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
--- 6937,6957 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
!     original_line_islabel = cin_islabel(curbuf->b_ind_maxcomment);  /* XXX */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * #defines and so on always go at the left when included in 'cinkeys'.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE)))
Karsten Hopp 1c310d
! 	amount = curbuf->b_ind_hash_comment;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * Is it a non-case label?	Then that goes at the left margin too unless:
Karsten Hopp 1c310d
       *  - JS flag is set.
Karsten Hopp 1c310d
       *  - 'L' item has a positive value.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
!     else if (original_line_islabel && !curbuf->b_ind_js
Karsten Hopp 1c310d
! 					      && curbuf->b_ind_jump_label < 0)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	amount = 0;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7027,7033 ****
Karsten Hopp 1c310d
       * comment, try using the 'comments' option.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      else if (!cin_iscomment(theline)
Karsten Hopp 1c310d
! 	    && (trypos = find_start_comment(ind_maxcomment)) != NULL) /* XXX */
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	int	lead_start_len = 2;
Karsten Hopp 1c310d
  	int	lead_middle_len = 1;
Karsten Hopp 1c310d
--- 6973,6980 ----
Karsten Hopp 1c310d
       * comment, try using the 'comments' option.
Karsten Hopp 1c310d
       */
Karsten Hopp 1c310d
      else if (!cin_iscomment(theline)
Karsten Hopp 1c310d
! 	    && (trypos = find_start_comment(curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
! 	/* XXX */
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	int	lead_start_len = 2;
Karsten Hopp 1c310d
  	int	lead_middle_len = 1;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7161,7167 ****
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    if (amount == -1)			    /* use the comment opener */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		if (!ind_in_comment2)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    start = ml_get(trypos->lnum);
Karsten Hopp 1c310d
  		    look = start + trypos->col + 2; /* skip / and * */
Karsten Hopp 1c310d
--- 7108,7114 ----
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    if (amount == -1)			    /* use the comment opener */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		if (!curbuf->b_ind_in_comment2)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    start = ml_get(trypos->lnum);
Karsten Hopp 1c310d
  		    look = start + trypos->col + 2; /* skip / and * */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7170,7177 ****
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		getvcol(curwin, trypos, &col, NULL, NULL);
Karsten Hopp 1c310d
  		amount = col;
Karsten Hopp 1c310d
! 		if (ind_in_comment2 || *look == NUL)
Karsten Hopp 1c310d
! 		    amount += ind_in_comment;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
--- 7117,7124 ----
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		getvcol(curwin, trypos, &col, NULL, NULL);
Karsten Hopp 1c310d
  		amount = col;
Karsten Hopp 1c310d
! 		if (curbuf->b_ind_in_comment2 || *look == NUL)
Karsten Hopp 1c310d
! 		    amount += curbuf->b_ind_in_comment;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7179,7187 ****
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * Are we inside parentheses or braces?
Karsten Hopp 1c310d
       */						    /* XXX */
Karsten Hopp 1c310d
!     else if (((trypos = find_match_paren(ind_maxparen, ind_maxcomment)) != NULL
Karsten Hopp 1c310d
! 		&& ind_java == 0)
Karsten Hopp 1c310d
! 	    || (tryposBrace = find_start_brace(ind_maxcomment)) != NULL
Karsten Hopp 1c310d
  	    || trypos != NULL)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
        if (trypos != NULL && tryposBrace != NULL)
Karsten Hopp 1c310d
--- 7126,7136 ----
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
       * Are we inside parentheses or braces?
Karsten Hopp 1c310d
       */						    /* XXX */
Karsten Hopp 1c310d
!     else if (((trypos = find_match_paren(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment)) != NULL
Karsten Hopp 1c310d
! 		&& curbuf->b_ind_java == 0)
Karsten Hopp 1c310d
! 	    || (tryposBrace =
Karsten Hopp 1c310d
! 			   find_start_brace(curbuf->b_ind_maxcomment)) != NULL
Karsten Hopp 1c310d
  	    || trypos != NULL)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
        if (trypos != NULL && tryposBrace != NULL)
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7202,7208 ****
Karsten Hopp 1c310d
  	 * If the matching paren is more than one line away, use the indent of
Karsten Hopp 1c310d
  	 * a previous non-empty line that matches the same paren.
Karsten Hopp 1c310d
  	 */
Karsten Hopp 1c310d
! 	if (theline[0] == ')' && ind_paren_prev)
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
  	    /* Line up with the start of the matching paren line. */
Karsten Hopp 1c310d
  	    amount = get_indent_lnum(curwin->w_cursor.lnum - 1);  /* XXX */
Karsten Hopp 1c310d
--- 7151,7157 ----
Karsten Hopp 1c310d
  	 * If the matching paren is more than one line away, use the indent of
Karsten Hopp 1c310d
  	 * a previous non-empty line that matches the same paren.
Karsten Hopp 1c310d
  	 */
Karsten Hopp 1c310d
! 	if (theline[0] == ')' && curbuf->b_ind_paren_prev)
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
  	    /* Line up with the start of the matching paren line. */
Karsten Hopp 1c310d
  	    amount = get_indent_lnum(curwin->w_cursor.lnum - 1);  /* XXX */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7221,7227 ****
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = lnum;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		/* Skip a comment. XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    continue;
Karsten Hopp 1c310d
--- 7170,7177 ----
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = lnum;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		/* Skip a comment. XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
! 								      != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    continue;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7229,7236 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		/* XXX */
Karsten Hopp 1c310d
  		if ((trypos = find_match_paren(
Karsten Hopp 1c310d
! 				corr_ind_maxparen(ind_maxparen, &cur_curpos),
Karsten Hopp 1c310d
! 						      ind_maxcomment)) != NULL
Karsten Hopp 1c310d
  			&& trypos->lnum == our_paren_pos.lnum
Karsten Hopp 1c310d
  			&& trypos->col == our_paren_pos.col)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
--- 7179,7186 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		/* XXX */
Karsten Hopp 1c310d
  		if ((trypos = find_match_paren(
Karsten Hopp 1c310d
! 		       corr_ind_maxparen(curbuf->b_ind_maxparen, &cur_curpos),
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment)) != NULL
Karsten Hopp 1c310d
  			&& trypos->lnum == our_paren_pos.lnum
Karsten Hopp 1c310d
  			&& trypos->col == our_paren_pos.col)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7258,7264 ****
Karsten Hopp 1c310d
  	    int	    ignore_paren_col = 0;
Karsten Hopp 1c310d
  	    int	    is_if_for_while = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    if (ind_if_for_while)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/* Look for the outermost opening parenthesis on this line
Karsten Hopp 1c310d
  		 * and check whether it belongs to an "if", "for" or "while". */
Karsten Hopp 1c310d
--- 7208,7214 ----
Karsten Hopp 1c310d
  	    int	    ignore_paren_col = 0;
Karsten Hopp 1c310d
  	    int	    is_if_for_while = 0;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    if (curbuf->b_ind_if_for_while)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/* Look for the outermost opening parenthesis on this line
Karsten Hopp 1c310d
  		 * and check whether it belongs to an "if", "for" or "while". */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7273,7279 ****
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = outermost.lnum;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = outermost.col;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		    trypos = find_match_paren(ind_maxparen, ind_maxcomment);
Karsten Hopp 1c310d
  		} while (trypos && trypos->lnum == outermost.lnum);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		curwin->w_cursor = cursor_save;
Karsten Hopp 1c310d
--- 7223,7230 ----
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = outermost.lnum;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = outermost.col;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		    trypos = find_match_paren(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  		} while (trypos && trypos->lnum == outermost.lnum);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		curwin->w_cursor = cursor_save;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7284,7290 ****
Karsten Hopp 1c310d
  		    cin_is_if_for_while_before_offset(line, &outermost.col);
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    amount = skip_label(our_paren_pos.lnum, &look, ind_maxcomment);
Karsten Hopp 1c310d
  	    look = skipwhite(look);
Karsten Hopp 1c310d
  	    if (*look == '(')
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
--- 7235,7242 ----
Karsten Hopp 1c310d
  		    cin_is_if_for_while_before_offset(line, &outermost.col);
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    amount = skip_label(our_paren_pos.lnum, &look,
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  	    look = skipwhite(look);
Karsten Hopp 1c310d
  	    if (*look == '(')
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7298,7304 ****
Karsten Hopp 1c310d
  		line = ml_get_curline();
Karsten Hopp 1c310d
  		look_col = (int)(look - line);
Karsten Hopp 1c310d
  		curwin->w_cursor.col = look_col + 1;
Karsten Hopp 1c310d
! 		if ((trypos = findmatchlimit(NULL, ')', 0, ind_maxparen))
Karsten Hopp 1c310d
  								      != NULL
Karsten Hopp 1c310d
  			  && trypos->lnum == our_paren_pos.lnum
Karsten Hopp 1c310d
  			  && trypos->col < our_paren_pos.col)
Karsten Hopp 1c310d
--- 7250,7257 ----
Karsten Hopp 1c310d
  		line = ml_get_curline();
Karsten Hopp 1c310d
  		look_col = (int)(look - line);
Karsten Hopp 1c310d
  		curwin->w_cursor.col = look_col + 1;
Karsten Hopp 1c310d
! 		if ((trypos = findmatchlimit(NULL, ')', 0,
Karsten Hopp 1c310d
! 						      curbuf->b_ind_maxparen))
Karsten Hopp 1c310d
  								      != NULL
Karsten Hopp 1c310d
  			  && trypos->lnum == our_paren_pos.lnum
Karsten Hopp 1c310d
  			  && trypos->col < our_paren_pos.col)
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7307,7330 ****
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = save_lnum;
Karsten Hopp 1c310d
  		look = ml_get(our_paren_pos.lnum) + look_col;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
! 	    if (theline[0] == ')' || (ind_unclosed == 0 && is_if_for_while == 0)
Karsten Hopp 1c310d
! 		    || (!ind_unclosed_noignore && *look == '('
Karsten Hopp 1c310d
  						    && ignore_paren_col == 0))
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're looking at a close paren, line up right there;
Karsten Hopp 1c310d
  		 * otherwise, line up with the next (non-white) character.
Karsten Hopp 1c310d
! 		 * When ind_unclosed_wrapped is set and the matching paren is
Karsten Hopp 1c310d
  		 * the last nonwhite character of the line, use either the
Karsten Hopp 1c310d
  		 * indent of the current line or the indentation of the next
Karsten Hopp 1c310d
! 		 * outer paren and add ind_unclosed_wrapped (for very long
Karsten Hopp 1c310d
  		 * lines).
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (theline[0] != ')')
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    cur_amount = MAXCOL;
Karsten Hopp 1c310d
  		    l = ml_get(our_paren_pos.lnum);
Karsten Hopp 1c310d
! 		    if (ind_unclosed_wrapped
Karsten Hopp 1c310d
  				       && cin_ends_in(l, (char_u *)"(", NULL))
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			/* look for opening unmatched paren, indent one level
Karsten Hopp 1c310d
--- 7260,7284 ----
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = save_lnum;
Karsten Hopp 1c310d
  		look = ml_get(our_paren_pos.lnum) + look_col;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
! 	    if (theline[0] == ')' || (curbuf->b_ind_unclosed == 0
Karsten Hopp 1c310d
! 						      && is_if_for_while == 0)
Karsten Hopp 1c310d
! 		    || (!curbuf->b_ind_unclosed_noignore && *look == '('
Karsten Hopp 1c310d
  						    && ignore_paren_col == 0))
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're looking at a close paren, line up right there;
Karsten Hopp 1c310d
  		 * otherwise, line up with the next (non-white) character.
Karsten Hopp 1c310d
! 		 * When b_ind_unclosed_wrapped is set and the matching paren is
Karsten Hopp 1c310d
  		 * the last nonwhite character of the line, use either the
Karsten Hopp 1c310d
  		 * indent of the current line or the indentation of the next
Karsten Hopp 1c310d
! 		 * outer paren and add b_ind_unclosed_wrapped (for very long
Karsten Hopp 1c310d
  		 * lines).
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (theline[0] != ')')
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    cur_amount = MAXCOL;
Karsten Hopp 1c310d
  		    l = ml_get(our_paren_pos.lnum);
Karsten Hopp 1c310d
! 		    if (curbuf->b_ind_unclosed_wrapped
Karsten Hopp 1c310d
  				       && cin_ends_in(l, (char_u *)"(", NULL))
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			/* look for opening unmatched paren, indent one level
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7346,7354 ****
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			our_paren_pos.col = 0;
Karsten Hopp 1c310d
! 			amount += n * ind_unclosed_wrapped;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
! 		    else if (ind_unclosed_whiteok)
Karsten Hopp 1c310d
  			our_paren_pos.col++;
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
--- 7300,7308 ----
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			our_paren_pos.col = 0;
Karsten Hopp 1c310d
! 			amount += n * curbuf->b_ind_unclosed_wrapped;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
! 		    else if (curbuf->b_ind_unclosed_whiteok)
Karsten Hopp 1c310d
  			our_paren_pos.col++;
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7374,7385 ****
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    if (theline[0] == ')' && ind_matching_paren)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/* Line up with the start of the matching paren line. */
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
! 	    else if ((ind_unclosed == 0 && is_if_for_while == 0)
Karsten Hopp 1c310d
! 		     || (!ind_unclosed_noignore
Karsten Hopp 1c310d
  				    && *look == '(' && ignore_paren_col == 0))
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		if (cur_amount != MAXCOL)
Karsten Hopp 1c310d
--- 7328,7339 ----
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 	    if (theline[0] == ')' && curbuf->b_ind_matching_paren)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		/* Line up with the start of the matching paren line. */
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
! 	    else if ((curbuf->b_ind_unclosed == 0 && is_if_for_while == 0)
Karsten Hopp 1c310d
! 		     || (!curbuf->b_ind_unclosed_noignore
Karsten Hopp 1c310d
  				    && *look == '(' && ignore_paren_col == 0))
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		if (cur_amount != MAXCOL)
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7387,7425 ****
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		/* Add ind_unclosed2 for each '(' before our matching one, but
Karsten Hopp 1c310d
! 		 * ignore (void) before the line (ignore_paren_col). */
Karsten Hopp 1c310d
  		col = our_paren_pos.col;
Karsten Hopp 1c310d
  		while ((int)our_paren_pos.col > ignore_paren_col)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    --our_paren_pos.col;
Karsten Hopp 1c310d
  		    switch (*ml_get_pos(&our_paren_pos))
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
! 			case '(': amount += ind_unclosed2;
Karsten Hopp 1c310d
  				  col = our_paren_pos.col;
Karsten Hopp 1c310d
  				  break;
Karsten Hopp 1c310d
! 			case ')': amount -= ind_unclosed2;
Karsten Hopp 1c310d
  				  col = MAXCOL;
Karsten Hopp 1c310d
  				  break;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		/* Use ind_unclosed once, when the first '(' is not inside
Karsten Hopp 1c310d
  		 * braces */
Karsten Hopp 1c310d
  		if (col == MAXCOL)
Karsten Hopp 1c310d
! 		    amount += ind_unclosed;
Karsten Hopp 1c310d
  		else
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = col;
Karsten Hopp 1c310d
! 		    if (find_match_paren(ind_maxparen, ind_maxcomment) != NULL)
Karsten Hopp 1c310d
! 			amount += ind_unclosed2;
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			if (is_if_for_while)
Karsten Hopp 1c310d
! 			    amount += ind_if_for_while;
Karsten Hopp 1c310d
  			else
Karsten Hopp 1c310d
! 			    amount += ind_unclosed;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
--- 7341,7380 ----
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		/* Add b_ind_unclosed2 for each '(' before our matching one,
Karsten Hopp 1c310d
! 		 * but ignore (void) before the line (ignore_paren_col). */
Karsten Hopp 1c310d
  		col = our_paren_pos.col;
Karsten Hopp 1c310d
  		while ((int)our_paren_pos.col > ignore_paren_col)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    --our_paren_pos.col;
Karsten Hopp 1c310d
  		    switch (*ml_get_pos(&our_paren_pos))
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
! 			case '(': amount += curbuf->b_ind_unclosed2;
Karsten Hopp 1c310d
  				  col = our_paren_pos.col;
Karsten Hopp 1c310d
  				  break;
Karsten Hopp 1c310d
! 			case ')': amount -= curbuf->b_ind_unclosed2;
Karsten Hopp 1c310d
  				  col = MAXCOL;
Karsten Hopp 1c310d
  				  break;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		/* Use b_ind_unclosed once, when the first '(' is not inside
Karsten Hopp 1c310d
  		 * braces */
Karsten Hopp 1c310d
  		if (col == MAXCOL)
Karsten Hopp 1c310d
! 		    amount += curbuf->b_ind_unclosed;
Karsten Hopp 1c310d
  		else
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = col;
Karsten Hopp 1c310d
! 		    if (find_match_paren(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment) != NULL)
Karsten Hopp 1c310d
! 			amount += curbuf->b_ind_unclosed2;
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			if (is_if_for_while)
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_if_for_while;
Karsten Hopp 1c310d
  			else
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_unclosed;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7437,7443 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/* add extra indent for a comment */
Karsten Hopp 1c310d
  	if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 	    amount += ind_comment;
Karsten Hopp 1c310d
        }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /*
Karsten Hopp 1c310d
--- 7392,7398 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/* add extra indent for a comment */
Karsten Hopp 1c310d
  	if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 	    amount += curbuf->b_ind_comment;
Karsten Hopp 1c310d
        }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7480,7487 ****
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
  	    lnum = ourscope;
Karsten Hopp 1c310d
  	    if (find_last_paren(start, '(', ')')
Karsten Hopp 1c310d
! 		    && (trypos = find_match_paren(ind_maxparen,
Karsten Hopp 1c310d
! 						     ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		lnum = trypos->lnum;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /*
Karsten Hopp 1c310d
--- 7435,7442 ----
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
  	    lnum = ourscope;
Karsten Hopp 1c310d
  	    if (find_last_paren(start, '(', ')')
Karsten Hopp 1c310d
! 		    && (trypos = find_match_paren(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		lnum = trypos->lnum;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7490,7500 ****
Karsten Hopp 1c310d
  	     *			ldfd) {
Karsten Hopp 1c310d
  	     *		    }
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
! 	    if (ind_js || (ind_keep_case_label
Karsten Hopp 1c310d
  			   && cin_iscase(skipwhite(ml_get_curline()), FALSE)))
Karsten Hopp 1c310d
  		amount = get_indent();
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
! 		amount = skip_label(lnum, &l, ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    start_brace = BRACE_AT_END;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
--- 7445,7455 ----
Karsten Hopp 1c310d
  	     *			ldfd) {
Karsten Hopp 1c310d
  	     *		    }
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
! 	    if (curbuf->b_ind_js || (curbuf->b_ind_keep_case_label
Karsten Hopp 1c310d
  			   && cin_iscase(skipwhite(ml_get_curline()), FALSE)))
Karsten Hopp 1c310d
  		amount = get_indent();
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
! 		amount = skip_label(lnum, &l, curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    start_brace = BRACE_AT_END;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7510,7516 ****
Karsten Hopp 1c310d
  	     * they may want closing braces to line up with something
Karsten Hopp 1c310d
  	     * other than the open brace.  indulge them, if so.
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
! 	    amount += ind_close_extra;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  	else
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
--- 7465,7471 ----
Karsten Hopp 1c310d
  	     * they may want closing braces to line up with something
Karsten Hopp 1c310d
  	     * other than the open brace.  indulge them, if so.
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
! 	    amount += curbuf->b_ind_close_extra;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  	else
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7523,7536 ****
Karsten Hopp 1c310d
  	    lookfor = LOOKFOR_INITIAL;
Karsten Hopp 1c310d
  	    if (cin_iselse(theline))
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_IF;
Karsten Hopp 1c310d
! 	    else if (cin_iswhileofdo(theline, cur_curpos.lnum, ind_maxparen))
Karsten Hopp 1c310d
! 								    /* XXX */
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_DO;
Karsten Hopp 1c310d
  	    if (lookfor != LOOKFOR_INITIAL)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = cur_curpos.lnum;
Karsten Hopp 1c310d
! 		if (find_match(lookfor, ourscope, ind_maxparen,
Karsten Hopp 1c310d
! 							ind_maxcomment) == OK)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    amount = get_indent();	/* XXX */
Karsten Hopp 1c310d
  		    goto theend;
Karsten Hopp 1c310d
--- 7478,7491 ----
Karsten Hopp 1c310d
  	    lookfor = LOOKFOR_INITIAL;
Karsten Hopp 1c310d
  	    if (cin_iselse(theline))
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_IF;
Karsten Hopp 1c310d
! 	    else if (cin_iswhileofdo(theline, cur_curpos.lnum,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxparen)) /* XXX */
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_DO;
Karsten Hopp 1c310d
  	    if (lookfor != LOOKFOR_INITIAL)
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		curwin->w_cursor.lnum = cur_curpos.lnum;
Karsten Hopp 1c310d
! 		if (find_match(lookfor, ourscope, curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					      curbuf->b_ind_maxcomment) == OK)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    amount = get_indent();	/* XXX */
Karsten Hopp 1c310d
  		    goto theend;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7547,7558 ****
Karsten Hopp 1c310d
  	    /*
Karsten Hopp 1c310d
  	     * if the '{' is  _really_ at the left margin, use the imaginary
Karsten Hopp 1c310d
  	     * location of a left-margin brace.  Otherwise, correct the
Karsten Hopp 1c310d
! 	     * location for ind_open_extra.
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (start_brace == BRACE_IN_COL0)	    /* '{' is in column 0 */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		amount = ind_open_left_imag;
Karsten Hopp 1c310d
  		lookfor_cpp_namespace = TRUE;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else if (start_brace == BRACE_AT_START &&
Karsten Hopp 1c310d
--- 7502,7513 ----
Karsten Hopp 1c310d
  	    /*
Karsten Hopp 1c310d
  	     * if the '{' is  _really_ at the left margin, use the imaginary
Karsten Hopp 1c310d
  	     * location of a left-margin brace.  Otherwise, correct the
Karsten Hopp 1c310d
! 	     * location for b_ind_open_extra.
Karsten Hopp 1c310d
  	     */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    if (start_brace == BRACE_IN_COL0)	    /* '{' is in column 0 */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		amount = curbuf->b_ind_open_left_imag;
Karsten Hopp 1c310d
  		lookfor_cpp_namespace = TRUE;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else if (start_brace == BRACE_AT_START &&
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7565,7580 ****
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		if (start_brace == BRACE_AT_END)    /* '{' is at end of line */
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    amount += ind_open_imag;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    l = skipwhite(ml_get_curline());
Karsten Hopp 1c310d
  		    if (cin_is_cpp_namespace(l))
Karsten Hopp 1c310d
! 			amount += ind_cpp_namespace;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		else
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    /* Compensate for adding ind_open_extra later. */
Karsten Hopp 1c310d
! 		    amount -= ind_open_extra;
Karsten Hopp 1c310d
  		    if (amount < 0)
Karsten Hopp 1c310d
  			amount = 0;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
--- 7520,7535 ----
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		if (start_brace == BRACE_AT_END)    /* '{' is at end of line */
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    amount += curbuf->b_ind_open_imag;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    l = skipwhite(ml_get_curline());
Karsten Hopp 1c310d
  		    if (cin_is_cpp_namespace(l))
Karsten Hopp 1c310d
! 			amount += curbuf->b_ind_cpp_namespace;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		else
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    /* Compensate for adding b_ind_open_extra later. */
Karsten Hopp 1c310d
! 		    amount -= curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  		    if (amount < 0)
Karsten Hopp 1c310d
  			amount = 0;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7585,7604 ****
Karsten Hopp 1c310d
  	    if (cin_iscase(theline, FALSE))	/* it's a switch() label */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_CASE;	/* find a previous switch() label */
Karsten Hopp 1c310d
! 		amount += ind_case;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else if (cin_isscopedecl(theline))	/* private:, ... */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_SCOPEDECL;	/* class decl is this block */
Karsten Hopp 1c310d
! 		amount += ind_scopedecl;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		if (ind_case_break && cin_isbreak(theline))	/* break; ... */
Karsten Hopp 1c310d
  		    lookfor_break = TRUE;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_INITIAL;
Karsten Hopp 1c310d
! 		amount += ind_level;	/* ind_level from start of block */
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    scope_amount = amount;
Karsten Hopp 1c310d
  	    whilelevel = 0;
Karsten Hopp 1c310d
--- 7540,7561 ----
Karsten Hopp 1c310d
  	    if (cin_iscase(theline, FALSE))	/* it's a switch() label */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_CASE;	/* find a previous switch() label */
Karsten Hopp 1c310d
! 		amount += curbuf->b_ind_case;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else if (cin_isscopedecl(theline))	/* private:, ... */
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_SCOPEDECL;	/* class decl is this block */
Karsten Hopp 1c310d
! 		amount += curbuf->b_ind_scopedecl;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    else
Karsten Hopp 1c310d
  	    {
Karsten Hopp 1c310d
! 		if (curbuf->b_ind_case_break && cin_isbreak(theline))
Karsten Hopp 1c310d
! 		    /* break; ... */
Karsten Hopp 1c310d
  		    lookfor_break = TRUE;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		lookfor = LOOKFOR_INITIAL;
Karsten Hopp 1c310d
! 		/* b_ind_level from start of block */
Karsten Hopp 1c310d
! 		amount += curbuf->b_ind_level;
Karsten Hopp 1c310d
  	    }
Karsten Hopp 1c310d
  	    scope_amount = amount;
Karsten Hopp 1c310d
  	    whilelevel = 0;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7636,7649 ****
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			if (curwin->w_cursor.lnum == 0
Karsten Hopp 1c310d
  				|| curwin->w_cursor.lnum
Karsten Hopp 1c310d
! 						    < ourscope - ind_maxparen)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    /* nothing found (abuse ind_maxparen as limit)
Karsten Hopp 1c310d
! 			     * assume terminated line (i.e. a variable
Karsten Hopp 1c310d
  			     * initialization) */
Karsten Hopp 1c310d
  			    if (cont_amount > 0)
Karsten Hopp 1c310d
  				amount = cont_amount;
Karsten Hopp 1c310d
! 			    else if (!ind_js)
Karsten Hopp 1c310d
  				amount += ind_continuation;
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
--- 7593,7606 ----
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			if (curwin->w_cursor.lnum == 0
Karsten Hopp 1c310d
  				|| curwin->w_cursor.lnum
Karsten Hopp 1c310d
! 					  < ourscope - curbuf->b_ind_maxparen)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    /* nothing found (abuse curbuf->b_ind_maxparen as
Karsten Hopp 1c310d
! 			     * limit) assume terminated line (i.e. a variable
Karsten Hopp 1c310d
  			     * initialization) */
Karsten Hopp 1c310d
  			    if (cont_amount > 0)
Karsten Hopp 1c310d
  				amount = cont_amount;
Karsten Hopp 1c310d
! 			    else if (!curbuf->b_ind_js)
Karsten Hopp 1c310d
  				amount += ind_continuation;
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7654,7660 ****
Karsten Hopp 1c310d
  			 * If we're in a comment now, skip to the start of the
Karsten Hopp 1c310d
  			 * comment.
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
! 			trypos = find_start_comment(ind_maxcomment);
Karsten Hopp 1c310d
  			if (trypos != NULL)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
--- 7611,7617 ----
Karsten Hopp 1c310d
  			 * If we're in a comment now, skip to the start of the
Karsten Hopp 1c310d
  			 * comment.
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
! 			trypos = find_start_comment(curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  			if (trypos != NULL)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7680,7686 ****
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			if (start_brace != BRACE_IN_COL0
Karsten Hopp 1c310d
  				|| !cin_isfuncdecl(&l, curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 					     0, ind_maxparen, ind_maxcomment))
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /* if the line is terminated with another ','
Karsten Hopp 1c310d
  			     * it is a continued variable initialization.
Karsten Hopp 1c310d
--- 7637,7644 ----
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			if (start_brace != BRACE_IN_COL0
Karsten Hopp 1c310d
  				|| !cin_isfuncdecl(&l, curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 					     0, curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /* if the line is terminated with another ','
Karsten Hopp 1c310d
  			     * it is a continued variable initialization.
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7711,7721 ****
Karsten Hopp 1c310d
  			     */					/* XXX */
Karsten Hopp 1c310d
  			    trypos = NULL;
Karsten Hopp 1c310d
  			    if (find_last_paren(l, '(', ')'))
Karsten Hopp 1c310d
! 				trypos = find_match_paren(ind_maxparen,
Karsten Hopp 1c310d
! 					ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    if (trypos == NULL && find_last_paren(l, '{', '}'))
Karsten Hopp 1c310d
! 				trypos = find_start_brace(ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    if (trypos != NULL)
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
--- 7669,7681 ----
Karsten Hopp 1c310d
  			     */					/* XXX */
Karsten Hopp 1c310d
  			    trypos = NULL;
Karsten Hopp 1c310d
  			    if (find_last_paren(l, '(', ')'))
Karsten Hopp 1c310d
! 				trypos = find_match_paren(
Karsten Hopp 1c310d
! 						curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 						curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    if (trypos == NULL && find_last_paren(l, '{', '}'))
Karsten Hopp 1c310d
! 				trypos = find_start_brace(
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    if (trypos != NULL)
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7750,7757 ****
Karsten Hopp 1c310d
  			    amount = scope_amount;
Karsten Hopp 1c310d
  			    if (theline[0] == '{')
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				amount += ind_open_extra;
Karsten Hopp 1c310d
! 				added_to_amount = ind_open_extra;
Karsten Hopp 1c310d
  			    }
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 7710,7717 ----
Karsten Hopp 1c310d
  			    amount = scope_amount;
Karsten Hopp 1c310d
  			    if (theline[0] == '{')
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
! 				added_to_amount = curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  			    }
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7773,7779 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    /* If we're in a comment now, skip to the start of
Karsten Hopp 1c310d
  			     * the comment. */
Karsten Hopp 1c310d
! 			    trypos = find_start_comment(ind_maxcomment);
Karsten Hopp 1c310d
  			    if (trypos != NULL)
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
  				curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
--- 7733,7740 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			    /* If we're in a comment now, skip to the start of
Karsten Hopp 1c310d
  			     * the comment. */
Karsten Hopp 1c310d
! 			    trypos = find_start_comment(
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  			    if (trypos != NULL)
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
  				curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7788,7794 ****
Karsten Hopp 1c310d
  			    /* Finally the actual check for "namespace". */
Karsten Hopp 1c310d
  			    if (cin_is_cpp_namespace(l))
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				amount += ind_cpp_namespace - added_to_amount;
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 7749,7756 ----
Karsten Hopp 1c310d
  			    /* Finally the actual check for "namespace". */
Karsten Hopp 1c310d
  			    if (cin_is_cpp_namespace(l))
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				amount += curbuf->b_ind_cpp_namespace
Karsten Hopp 1c310d
! 							    - added_to_amount;
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			    }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7802,7808 ****
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're in a comment now, skip to the start of the comment.
Karsten Hopp 1c310d
  		 */					    /* XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
--- 7764,7771 ----
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're in a comment now, skip to the start of the comment.
Karsten Hopp 1c310d
  		 */					    /* XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
! 								      != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7856,7863 ****
Karsten Hopp 1c310d
  			 * Check that this case label is not for another
Karsten Hopp 1c310d
  			 * switch()
Karsten Hopp 1c310d
  			 */				    /* XXX */
Karsten Hopp 1c310d
! 			if ((trypos = find_start_brace(ind_maxcomment)) ==
Karsten Hopp 1c310d
! 					     NULL || trypos->lnum == ourscope)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    amount = get_indent();	/* XXX */
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
--- 7819,7827 ----
Karsten Hopp 1c310d
  			 * Check that this case label is not for another
Karsten Hopp 1c310d
  			 * switch()
Karsten Hopp 1c310d
  			 */				    /* XXX */
Karsten Hopp 1c310d
! 			if ((trypos = find_start_brace(
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment)) == NULL
Karsten Hopp 1c310d
! 						  || trypos->lnum == ourscope)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    amount = get_indent();	/* XXX */
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7900,7908 ****
Karsten Hopp 1c310d
  			if (l != NULL && cin_is_cinword(l))
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    if (theline[0] == '{')
Karsten Hopp 1c310d
! 				amount += ind_open_extra;
Karsten Hopp 1c310d
  			    else
Karsten Hopp 1c310d
! 				amount += ind_level + ind_no_brace;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  			break;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
--- 7864,7873 ----
Karsten Hopp 1c310d
  			if (l != NULL && cin_is_cinword(l))
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    if (theline[0] == '{')
Karsten Hopp 1c310d
! 				amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  			    else
Karsten Hopp 1c310d
! 				amount += curbuf->b_ind_level
Karsten Hopp 1c310d
! 						     + curbuf->b_ind_no_brace;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  			break;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7916,7923 ****
Karsten Hopp 1c310d
  		     * ->   y = 1;
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    scope_amount = get_indent() + (iscase    /* XXX */
Karsten Hopp 1c310d
! 					? ind_case_code : ind_scopedecl_code);
Karsten Hopp 1c310d
! 		    lookfor = ind_case_break ? LOOKFOR_NOBREAK : LOOKFOR_ANY;
Karsten Hopp 1c310d
  		    continue;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 7881,7890 ----
Karsten Hopp 1c310d
  		     * ->   y = 1;
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    scope_amount = get_indent() + (iscase    /* XXX */
Karsten Hopp 1c310d
! 					? curbuf->b_ind_case_code
Karsten Hopp 1c310d
! 					: curbuf->b_ind_scopedecl_code);
Karsten Hopp 1c310d
! 		    lookfor = curbuf->b_ind_case_break
Karsten Hopp 1c310d
! 					      ? LOOKFOR_NOBREAK : LOOKFOR_ANY;
Karsten Hopp 1c310d
  		    continue;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7928,7934 ****
Karsten Hopp 1c310d
  		if (lookfor == LOOKFOR_CASE || lookfor == LOOKFOR_SCOPEDECL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    if (find_last_paren(l, '{', '}') && (trypos =
Karsten Hopp 1c310d
! 				    find_start_brace(ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  			curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
--- 7895,7901 ----
Karsten Hopp 1c310d
  		if (lookfor == LOOKFOR_CASE || lookfor == LOOKFOR_SCOPEDECL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    if (find_last_paren(l, '{', '}') && (trypos =
Karsten Hopp 1c310d
! 			  find_start_brace(curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  			curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7939,7945 ****
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * Ignore jump labels with nothing after them.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
! 		if (!ind_js && cin_islabel(ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    l = after_label(ml_get_curline());
Karsten Hopp 1c310d
  		    if (l == NULL || cin_nocode(l))
Karsten Hopp 1c310d
--- 7906,7912 ----
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * Ignore jump labels with nothing after them.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
! 		if (!curbuf->b_ind_js && cin_islabel(curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    l = after_label(ml_get_curline());
Karsten Hopp 1c310d
  		    if (l == NULL || cin_nocode(l))
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7962,7968 ****
Karsten Hopp 1c310d
  		 * constructor initialization?
Karsten Hopp 1c310d
  		 */						    /* XXX */
Karsten Hopp 1c310d
  		n = FALSE;
Karsten Hopp 1c310d
! 		if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    n = cin_is_cpp_baseclass(&col);
Karsten Hopp 1c310d
  		    l = ml_get_curline();
Karsten Hopp 1c310d
--- 7929,7935 ----
Karsten Hopp 1c310d
  		 * constructor initialization?
Karsten Hopp 1c310d
  		 */						    /* XXX */
Karsten Hopp 1c310d
  		n = FALSE;
Karsten Hopp 1c310d
! 		if (lookfor != LOOKFOR_TERM && curbuf->b_ind_cpp_baseclass > 0)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    n = cin_is_cpp_baseclass(&col);
Karsten Hopp 1c310d
  		    l = ml_get_curline();
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 7985,7992 ****
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  								     /* XXX */
Karsten Hopp 1c310d
! 			amount = get_baseclass_amount(col, ind_maxparen,
Karsten Hopp 1c310d
! 					   ind_maxcomment, ind_cpp_baseclass);
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		else if (lookfor == LOOKFOR_CPP_BASECLASS)
Karsten Hopp 1c310d
--- 7952,7961 ----
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  								     /* XXX */
Karsten Hopp 1c310d
! 			amount = get_baseclass_amount(col,
Karsten Hopp 1c310d
! 						   curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 						   curbuf->b_ind_maxcomment,
Karsten Hopp 1c310d
! 						   curbuf->b_ind_cpp_baseclass);
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  		else if (lookfor == LOOKFOR_CPP_BASECLASS)
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8029,8036 ****
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    (void)find_last_paren(l, '(', ')');
Karsten Hopp 1c310d
  		    trypos = find_match_paren(
Karsten Hopp 1c310d
! 				 corr_ind_maxparen(ind_maxparen, &cur_curpos),
Karsten Hopp 1c310d
! 							      ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
  		     * If we are looking for ',', we also look for matching
Karsten Hopp 1c310d
--- 7998,8005 ----
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    (void)find_last_paren(l, '(', ')');
Karsten Hopp 1c310d
  		    trypos = find_match_paren(
Karsten Hopp 1c310d
! 				 corr_ind_maxparen(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 				      &cur_curpos), curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
  		     * If we are looking for ',', we also look for matching
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8038,8044 ****
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    if (trypos == NULL && terminated == ','
Karsten Hopp 1c310d
  					      && find_last_paren(l, '{', '}'))
Karsten Hopp 1c310d
! 			trypos = find_start_brace(ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    if (trypos != NULL)
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
--- 8007,8013 ----
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
  		    if (trypos == NULL && terminated == ','
Karsten Hopp 1c310d
  					      && find_last_paren(l, '{', '}'))
Karsten Hopp 1c310d
! 			trypos = find_start_brace(curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    if (trypos != NULL)
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8081,8089 ****
Karsten Hopp 1c310d
  		     * Get indent and pointer to text for current line,
Karsten Hopp 1c310d
  		     * ignoring any jump label.	    XXX
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
! 		    if (!ind_js)
Karsten Hopp 1c310d
  			cur_amount = skip_label(curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 							  &l, ind_maxcomment);
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  			cur_amount = get_indent();
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
--- 8050,8058 ----
Karsten Hopp 1c310d
  		     * Get indent and pointer to text for current line,
Karsten Hopp 1c310d
  		     * ignoring any jump label.	    XXX
Karsten Hopp 1c310d
  		     */
Karsten Hopp 1c310d
! 		    if (!curbuf->b_ind_js)
Karsten Hopp 1c310d
  			cur_amount = skip_label(curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 						&l, curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  		    else
Karsten Hopp 1c310d
  			cur_amount = get_indent();
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8098,8113 ****
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			amount = cur_amount;
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
! 			 * Only add ind_open_extra when the current line
Karsten Hopp 1c310d
  			 * doesn't start with a '{', which must have a match
Karsten Hopp 1c310d
  			 * in the same line (scope is the same).  Probably:
Karsten Hopp 1c310d
  			 *	{ 1, 2 },
Karsten Hopp 1c310d
  			 * ->	{ 3, 4 }
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			if (*skipwhite(l) != '{')
Karsten Hopp 1c310d
! 			    amount += ind_open_extra;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 			if (ind_cpp_baseclass)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /* have to look back, whether it is a cpp base
Karsten Hopp 1c310d
  			     * class declaration or initialization */
Karsten Hopp 1c310d
--- 8067,8082 ----
Karsten Hopp 1c310d
  		    {
Karsten Hopp 1c310d
  			amount = cur_amount;
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
! 			 * Only add b_ind_open_extra when the current line
Karsten Hopp 1c310d
  			 * doesn't start with a '{', which must have a match
Karsten Hopp 1c310d
  			 * in the same line (scope is the same).  Probably:
Karsten Hopp 1c310d
  			 *	{ 1, 2 },
Karsten Hopp 1c310d
  			 * ->	{ 3, 4 }
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			if (*skipwhite(l) != '{')
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 			if (curbuf->b_ind_cpp_baseclass)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /* have to look back, whether it is a cpp base
Karsten Hopp 1c310d
  			     * class declaration or initialization */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8155,8164 ****
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			amount = cur_amount;
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += ind_open_extra;
Karsten Hopp 1c310d
  			if (lookfor != LOOKFOR_TERM)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    amount += ind_level + ind_no_brace;
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 8124,8134 ----
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			amount = cur_amount;
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  			if (lookfor != LOOKFOR_TERM)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_level
Karsten Hopp 1c310d
! 						     + curbuf->b_ind_no_brace;
Karsten Hopp 1c310d
  			    break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8192,8201 ****
Karsten Hopp 1c310d
  				curwin->w_cursor.col =
Karsten Hopp 1c310d
  					  (colnr_T)(l - ml_get_curline()) + 1;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 			    if ((trypos = find_start_brace(ind_maxcomment))
Karsten Hopp 1c310d
! 								       == NULL
Karsten Hopp 1c310d
  				    || find_match(LOOKFOR_IF, trypos->lnum,
Karsten Hopp 1c310d
! 					ind_maxparen, ind_maxcomment) == FAIL)
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
--- 8162,8172 ----
Karsten Hopp 1c310d
  				curwin->w_cursor.col =
Karsten Hopp 1c310d
  					  (colnr_T)(l - ml_get_curline()) + 1;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 			    if ((trypos = find_start_brace(
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment)) == NULL
Karsten Hopp 1c310d
  				    || find_match(LOOKFOR_IF, trypos->lnum,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment) == FAIL)
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8232,8238 ****
Karsten Hopp 1c310d
  			     * enumerations/initializations. */
Karsten Hopp 1c310d
  			    if (terminated == ',')
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				if (ind_cpp_baseclass == 0)
Karsten Hopp 1c310d
  				    break;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  				lookfor = LOOKFOR_CPP_BASECLASS;
Karsten Hopp 1c310d
--- 8203,8209 ----
Karsten Hopp 1c310d
  			     * enumerations/initializations. */
Karsten Hopp 1c310d
  			    if (terminated == ',')
Karsten Hopp 1c310d
  			    {
Karsten Hopp 1c310d
! 				if (curbuf->b_ind_cpp_baseclass == 0)
Karsten Hopp 1c310d
  				    break;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  				lookfor = LOOKFOR_CPP_BASECLASS;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8290,8297 ****
Karsten Hopp 1c310d
  		 * If so: Ignore until the matching "do".
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  							/* XXX */
Karsten Hopp 1c310d
! 		else if (cin_iswhileofdo_end(terminated, ind_maxparen,
Karsten Hopp 1c310d
! 							      ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
  		     * Found an unterminated line after a while ();, line up
Karsten Hopp 1c310d
--- 8261,8268 ----
Karsten Hopp 1c310d
  		 * If so: Ignore until the matching "do".
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  							/* XXX */
Karsten Hopp 1c310d
! 		else if (cin_iswhileofdo_end(terminated, curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 						    curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    /*
Karsten Hopp 1c310d
  		     * Found an unterminated line after a while ();, line up
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8315,8321 ****
Karsten Hopp 1c310d
  			lookfor = LOOKFOR_TERM;
Karsten Hopp 1c310d
  			amount = get_indent();	    /* XXX */
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += ind_open_extra;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		    ++whilelevel;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
--- 8286,8292 ----
Karsten Hopp 1c310d
  			lookfor = LOOKFOR_TERM;
Karsten Hopp 1c310d
  			amount = get_indent();	    /* XXX */
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  		    }
Karsten Hopp 1c310d
  		    ++whilelevel;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8408,8415 ****
Karsten Hopp 1c310d
  term_again:
Karsten Hopp 1c310d
  			l = ml_get_curline();
Karsten Hopp 1c310d
  			if (find_last_paren(l, '(', ')')
Karsten Hopp 1c310d
! 				&& (trypos = find_match_paren(ind_maxparen,
Karsten Hopp 1c310d
! 						     ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /*
Karsten Hopp 1c310d
  			     * Check if we are on a case label now.  This is
Karsten Hopp 1c310d
--- 8379,8387 ----
Karsten Hopp 1c310d
  term_again:
Karsten Hopp 1c310d
  			l = ml_get_curline();
Karsten Hopp 1c310d
  			if (find_last_paren(l, '(', ')')
Karsten Hopp 1c310d
! 				&& (trypos = find_match_paren(
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    /*
Karsten Hopp 1c310d
  			     * Check if we are on a case label now.  This is
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8436,8456 ****
Karsten Hopp 1c310d
  			 *	stat;
Karsten Hopp 1c310d
  			 * }
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
! 			iscase = (ind_keep_case_label && cin_iscase(l, FALSE));
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
  			 * Get indent and pointer to text for current line,
Karsten Hopp 1c310d
  			 * ignoring any jump label.
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			amount = skip_label(curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 							  &l, ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += ind_open_extra;
Karsten Hopp 1c310d
! 			/* See remark above: "Only add ind_open_extra.." */
Karsten Hopp 1c310d
  			l = skipwhite(l);
Karsten Hopp 1c310d
  			if (*l == '{')
Karsten Hopp 1c310d
! 			    amount -= ind_open_extra;
Karsten Hopp 1c310d
  			lookfor = iscase ? LOOKFOR_ANY : LOOKFOR_TERM;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
--- 8408,8429 ----
Karsten Hopp 1c310d
  			 *	stat;
Karsten Hopp 1c310d
  			 * }
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
! 			iscase = (curbuf->b_ind_keep_case_label
Karsten Hopp 1c310d
! 						     && cin_iscase(l, FALSE));
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
  			 * Get indent and pointer to text for current line,
Karsten Hopp 1c310d
  			 * ignoring any jump label.
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			amount = skip_label(curwin->w_cursor.lnum,
Karsten Hopp 1c310d
! 						&l, curbuf->b_ind_maxcomment);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			if (theline[0] == '{')
Karsten Hopp 1c310d
! 			    amount += curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
! 			/* See remark above: "Only add b_ind_open_extra.." */
Karsten Hopp 1c310d
  			l = skipwhite(l);
Karsten Hopp 1c310d
  			if (*l == '{')
Karsten Hopp 1c310d
! 			    amount -= curbuf->b_ind_open_extra;
Karsten Hopp 1c310d
  			lookfor = iscase ? LOOKFOR_ANY : LOOKFOR_TERM;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  			/*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8466,8475 ****
Karsten Hopp 1c310d
  				&& cin_iselse(l)
Karsten Hopp 1c310d
  				&& whilelevel == 0)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    if ((trypos = find_start_brace(ind_maxcomment))
Karsten Hopp 1c310d
! 								       == NULL
Karsten Hopp 1c310d
  				    || find_match(LOOKFOR_IF, trypos->lnum,
Karsten Hopp 1c310d
! 					ind_maxparen, ind_maxcomment) == FAIL)
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			    continue;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
--- 8439,8449 ----
Karsten Hopp 1c310d
  				&& cin_iselse(l)
Karsten Hopp 1c310d
  				&& whilelevel == 0)
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
! 			    if ((trypos = find_start_brace(
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment)) == NULL
Karsten Hopp 1c310d
  				    || find_match(LOOKFOR_IF, trypos->lnum,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					    curbuf->b_ind_maxcomment) == FAIL)
Karsten Hopp 1c310d
  				break;
Karsten Hopp 1c310d
  			    continue;
Karsten Hopp 1c310d
  			}
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8480,8487 ****
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			l = ml_get_curline();
Karsten Hopp 1c310d
  			if (find_last_paren(l, '{', '}')
Karsten Hopp 1c310d
! 				&& (trypos = find_start_brace(ind_maxcomment))
Karsten Hopp 1c310d
! 							    != NULL) /* XXX */
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  			    /* if not "else {" check for terminated again */
Karsten Hopp 1c310d
--- 8454,8461 ----
Karsten Hopp 1c310d
  			 */
Karsten Hopp 1c310d
  			l = ml_get_curline();
Karsten Hopp 1c310d
  			if (find_last_paren(l, '{', '}')
Karsten Hopp 1c310d
! 				&& (trypos = find_start_brace(
Karsten Hopp 1c310d
! 				 curbuf->b_ind_maxcomment)) != NULL) /* XXX */
Karsten Hopp 1c310d
  			{
Karsten Hopp 1c310d
  			    curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  			    /* if not "else {" check for terminated again */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8500,8510 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /* add extra indent for a comment */
Karsten Hopp 1c310d
        if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 	  amount += ind_comment;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /* subtract extra left-shift for jump labels */
Karsten Hopp 1c310d
!       if (ind_jump_label > 0 && original_line_islabel)
Karsten Hopp 1c310d
! 	  amount -= ind_jump_label;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
--- 8474,8484 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /* add extra indent for a comment */
Karsten Hopp 1c310d
        if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 	  amount += curbuf->b_ind_comment;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
        /* subtract extra left-shift for jump labels */
Karsten Hopp 1c310d
!       if (curbuf->b_ind_jump_label > 0 && original_line_islabel)
Karsten Hopp 1c310d
! 	  amount -= curbuf->b_ind_jump_label;
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8525,8531 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	if (theline[0] == '{')
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    amount = ind_first_open;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/*
Karsten Hopp 1c310d
--- 8499,8505 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	if (theline[0] == '{')
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    amount = curbuf->b_ind_first_open;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	/*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8543,8552 ****
Karsten Hopp 1c310d
  		&& !cin_ends_in(theline, (char_u *)",", NULL)
Karsten Hopp 1c310d
  		&& cin_isfuncdecl(NULL, cur_curpos.lnum + 1,
Karsten Hopp 1c310d
  				  cur_curpos.lnum + 1,
Karsten Hopp 1c310d
! 				  ind_maxparen, ind_maxcomment)
Karsten Hopp 1c310d
  		&& !cin_isterminated(theline, FALSE, TRUE))
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    amount = ind_func_type;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  	else
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
--- 8517,8527 ----
Karsten Hopp 1c310d
  		&& !cin_ends_in(theline, (char_u *)",", NULL)
Karsten Hopp 1c310d
  		&& cin_isfuncdecl(NULL, cur_curpos.lnum + 1,
Karsten Hopp 1c310d
  				  cur_curpos.lnum + 1,
Karsten Hopp 1c310d
! 				  curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 				  curbuf->b_ind_maxcomment)
Karsten Hopp 1c310d
  		&& !cin_isterminated(theline, FALSE, TRUE))
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
! 	    amount = curbuf->b_ind_func_type;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
  	else
Karsten Hopp 1c310d
  	{
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8565,8571 ****
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're in a comment now, skip to the start of the comment.
Karsten Hopp 1c310d
  		 */						/* XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
--- 8540,8547 ----
Karsten Hopp 1c310d
  		/*
Karsten Hopp 1c310d
  		 * If we're in a comment now, skip to the start of the comment.
Karsten Hopp 1c310d
  		 */						/* XXX */
Karsten Hopp 1c310d
! 		if ((trypos = find_start_comment(
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp 1c310d
  		    curwin->w_cursor.col = 0;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8577,8583 ****
Karsten Hopp 1c310d
  		 * constructor initialization?
Karsten Hopp 1c310d
  		 */						    /* XXX */
Karsten Hopp 1c310d
  		n = FALSE;
Karsten Hopp 1c310d
! 		if (ind_cpp_baseclass != 0 && theline[0] != '{')
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    n = cin_is_cpp_baseclass(&col);
Karsten Hopp 1c310d
  		    l = ml_get_curline();
Karsten Hopp 1c310d
--- 8553,8559 ----
Karsten Hopp 1c310d
  		 * constructor initialization?
Karsten Hopp 1c310d
  		 */						    /* XXX */
Karsten Hopp 1c310d
  		n = FALSE;
Karsten Hopp 1c310d
! 		if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{')
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    n = cin_is_cpp_baseclass(&col);
Karsten Hopp 1c310d
  		    l = ml_get_curline();
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8585,8592 ****
Karsten Hopp 1c310d
  		if (n)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  								     /* XXX */
Karsten Hopp 1c310d
! 		    amount = get_baseclass_amount(col, ind_maxparen,
Karsten Hopp 1c310d
! 					   ind_maxcomment, ind_cpp_baseclass);
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 8561,8569 ----
Karsten Hopp 1c310d
  		if (n)
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  								     /* XXX */
Karsten Hopp 1c310d
! 		    amount = get_baseclass_amount(col, curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_cpp_baseclass);
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8617,8624 ****
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    /* take us back to opening paren */
Karsten Hopp 1c310d
  		    if (find_last_paren(l, '(', ')')
Karsten Hopp 1c310d
! 			    && (trypos = find_match_paren(ind_maxparen,
Karsten Hopp 1c310d
! 						     ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  			curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    /* For a line ending in ',' that is a continuation line go
Karsten Hopp 1c310d
--- 8594,8602 ----
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
  		    /* take us back to opening paren */
Karsten Hopp 1c310d
  		    if (find_last_paren(l, '(', ')')
Karsten Hopp 1c310d
! 			    && (trypos = find_match_paren(
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  			curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  		    /* For a line ending in ',' that is a continuation line go
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8650,8656 ****
Karsten Hopp 1c310d
  		 * not in a comment, put it the left margin.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0,
Karsten Hopp 1c310d
! 				   ind_maxparen, ind_maxcomment))  /* XXX */
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		l = ml_get_curline();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 8628,8635 ----
Karsten Hopp 1c310d
  		 * not in a comment, put it the left margin.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (cin_isfuncdecl(NULL, cur_curpos.lnum, 0,
Karsten Hopp 1c310d
! 				   curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 				   curbuf->b_ind_maxcomment))  /* XXX */
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		l = ml_get_curline();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8699,8707 ****
Karsten Hopp 1c310d
  		 * parameters.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0,
Karsten Hopp 1c310d
! 				   ind_maxparen, ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    amount = ind_param;
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 8678,8687 ----
Karsten Hopp 1c310d
  		 * parameters.
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		if (cin_isfuncdecl(&l, curwin->w_cursor.lnum, 0,
Karsten Hopp 1c310d
! 				   curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 				   curbuf->b_ind_maxcomment))
Karsten Hopp 1c310d
  		{
Karsten Hopp 1c310d
! 		    amount = curbuf->b_ind_param;
Karsten Hopp 1c310d
  		    break;
Karsten Hopp 1c310d
  		}
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8730,8737 ****
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		find_last_paren(l, '(', ')');
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		if ((trypos = find_match_paren(ind_maxparen,
Karsten Hopp 1c310d
! 						     ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		    curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  		amount = get_indent();	    /* XXX */
Karsten Hopp 1c310d
  		break;
Karsten Hopp 1c310d
--- 8710,8717 ----
Karsten Hopp 1c310d
  		 */
Karsten Hopp 1c310d
  		find_last_paren(l, '(', ')');
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
! 		if ((trypos = find_match_paren(curbuf->b_ind_maxparen,
Karsten Hopp 1c310d
! 					   curbuf->b_ind_maxcomment)) != NULL)
Karsten Hopp 1c310d
  		    curwin->w_cursor = *trypos;
Karsten Hopp 1c310d
  		amount = get_indent();	    /* XXX */
Karsten Hopp 1c310d
  		break;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8739,8745 ****
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /* add extra indent for a comment */
Karsten Hopp 1c310d
  	    if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 		amount += ind_comment;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /* add extra indent if the previous line ended in a backslash:
Karsten Hopp 1c310d
  	     *	      "asdfasdf\
Karsten Hopp 1c310d
--- 8719,8725 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /* add extra indent for a comment */
Karsten Hopp 1c310d
  	    if (cin_iscomment(theline))
Karsten Hopp 1c310d
! 		amount += curbuf->b_ind_comment;
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  	    /* add extra indent if the previous line ended in a backslash:
Karsten Hopp 1c310d
  	     *	      "asdfasdf\
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/ops.c	2013-11-04 01:41:11.000000000 +0100
Karsten Hopp 1c310d
--- src/ops.c	2013-11-05 06:13:27.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 336,342 ****
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
      int		count;
Karsten Hopp 1c310d
      int		i, j;
Karsten Hopp 1c310d
!     int		p_sw = (int)get_sw_value();
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      count = get_indent();	/* get current indent */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
--- 336,342 ----
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
      int		count;
Karsten Hopp 1c310d
      int		i, j;
Karsten Hopp 1c310d
!     int		p_sw = (int)get_sw_value(curbuf);
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      count = get_indent();	/* get current indent */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 392,398 ****
Karsten Hopp 1c310d
      int			total;
Karsten Hopp 1c310d
      char_u		*newp, *oldp;
Karsten Hopp 1c310d
      int			oldcol = curwin->w_cursor.col;
Karsten Hopp 1c310d
!     int			p_sw = (int)get_sw_value();
Karsten Hopp 1c310d
      int			p_ts = (int)curbuf->b_p_ts;
Karsten Hopp 1c310d
      struct block_def	bd;
Karsten Hopp 1c310d
      int			incr;
Karsten Hopp 1c310d
--- 392,398 ----
Karsten Hopp 1c310d
      int			total;
Karsten Hopp 1c310d
      char_u		*newp, *oldp;
Karsten Hopp 1c310d
      int			oldcol = curwin->w_cursor.col;
Karsten Hopp 1c310d
!     int			p_sw = (int)get_sw_value(curbuf);
Karsten Hopp 1c310d
      int			p_ts = (int)curbuf->b_p_ts;
Karsten Hopp 1c310d
      struct block_def	bd;
Karsten Hopp 1c310d
      int			incr;
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 4046,4052 ****
Karsten Hopp 1c310d
  #  endif
Karsten Hopp 1c310d
  # endif
Karsten Hopp 1c310d
  # ifdef FEAT_CINDENT
Karsten Hopp 1c310d
! 	(curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE))
Karsten Hopp 1c310d
  # endif
Karsten Hopp 1c310d
  	;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
--- 4046,4053 ----
Karsten Hopp 1c310d
  #  endif
Karsten Hopp 1c310d
  # endif
Karsten Hopp 1c310d
  # ifdef FEAT_CINDENT
Karsten Hopp 1c310d
! 	(curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE)
Karsten Hopp 1c310d
! 					   && curbuf->b_ind_hash_comment == 0)
Karsten Hopp 1c310d
  # endif
Karsten Hopp 1c310d
  	;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/proto/misc1.pro	2013-11-04 02:53:46.000000000 +0100
Karsten Hopp 1c310d
--- src/proto/misc1.pro	2013-11-05 06:08:46.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 84,89 ****
Karsten Hopp 1c310d
--- 84,90 ----
Karsten Hopp 1c310d
  int cin_islabel __ARGS((int ind_maxcomment));
Karsten Hopp 1c310d
  int cin_iscase __ARGS((char_u *s, int strict));
Karsten Hopp 1c310d
  int cin_isscopedecl __ARGS((char_u *s));
Karsten Hopp 1c310d
+ void parse_cino __ARGS((buf_T *buf));
Karsten Hopp 1c310d
  int get_c_indent __ARGS((void));
Karsten Hopp 1c310d
  int get_expr_indent __ARGS((void));
Karsten Hopp 1c310d
  int get_lisp_indent __ARGS((void));
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/proto/option.pro	2013-08-10 13:37:22.000000000 +0200
Karsten Hopp 1c310d
--- src/proto/option.pro	2013-11-05 06:14:46.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 59,65 ****
Karsten Hopp 1c310d
  void save_file_ff __ARGS((buf_T *buf));
Karsten Hopp 1c310d
  int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));
Karsten Hopp 1c310d
  int check_ff_value __ARGS((char_u *p));
Karsten Hopp 1c310d
! long get_sw_value __ARGS((void));
Karsten Hopp 1c310d
  long get_sts_value __ARGS((void));
Karsten Hopp 1c310d
  void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
Karsten Hopp 1c310d
  /* vim: set ft=c : */
Karsten Hopp 1c310d
--- 59,65 ----
Karsten Hopp 1c310d
  void save_file_ff __ARGS((buf_T *buf));
Karsten Hopp 1c310d
  int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));
Karsten Hopp 1c310d
  int check_ff_value __ARGS((char_u *p));
Karsten Hopp 1c310d
! long get_sw_value __ARGS((buf_T *buf));
Karsten Hopp 1c310d
  long get_sts_value __ARGS((void));
Karsten Hopp 1c310d
  void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
Karsten Hopp 1c310d
  /* vim: set ft=c : */
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/structs.h	2013-07-03 15:35:59.000000000 +0200
Karsten Hopp 1c310d
--- src/structs.h	2013-11-05 05:08:26.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 1633,1638 ****
Karsten Hopp 1c310d
--- 1633,1677 ----
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /* end of buffer options */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
+ #ifdef FEAT_CINDENT
Karsten Hopp 1c310d
+     /* values set from b_p_cino */
Karsten Hopp 1c310d
+     int		b_ind_level;
Karsten Hopp 1c310d
+     int		b_ind_open_imag;
Karsten Hopp 1c310d
+     int		b_ind_no_brace;
Karsten Hopp 1c310d
+     int		b_ind_first_open;
Karsten Hopp 1c310d
+     int		b_ind_open_extra;
Karsten Hopp 1c310d
+     int		b_ind_close_extra;
Karsten Hopp 1c310d
+     int		b_ind_open_left_imag;
Karsten Hopp 1c310d
+     int		b_ind_jump_label;
Karsten Hopp 1c310d
+     int		b_ind_case;
Karsten Hopp 1c310d
+     int		b_ind_case_code;
Karsten Hopp 1c310d
+     int		b_ind_case_break;
Karsten Hopp 1c310d
+     int		b_ind_param;
Karsten Hopp 1c310d
+     int		b_ind_func_type;
Karsten Hopp 1c310d
+     int		b_ind_comment;
Karsten Hopp 1c310d
+     int		b_ind_in_comment;
Karsten Hopp 1c310d
+     int		b_ind_in_comment2;
Karsten Hopp 1c310d
+     int		b_ind_cpp_baseclass;
Karsten Hopp 1c310d
+     int		b_ind_continuation;
Karsten Hopp 1c310d
+     int		b_ind_unclosed;
Karsten Hopp 1c310d
+     int		b_ind_unclosed2;
Karsten Hopp 1c310d
+     int		b_ind_unclosed_noignore;
Karsten Hopp 1c310d
+     int		b_ind_unclosed_wrapped;
Karsten Hopp 1c310d
+     int		b_ind_unclosed_whiteok;
Karsten Hopp 1c310d
+     int		b_ind_matching_paren;
Karsten Hopp 1c310d
+     int		b_ind_paren_prev;
Karsten Hopp 1c310d
+     int		b_ind_maxparen;
Karsten Hopp 1c310d
+     int		b_ind_maxcomment;
Karsten Hopp 1c310d
+     int		b_ind_scopedecl;
Karsten Hopp 1c310d
+     int		b_ind_scopedecl_code;
Karsten Hopp 1c310d
+     int		b_ind_java;
Karsten Hopp 1c310d
+     int		b_ind_js;
Karsten Hopp 1c310d
+     int		b_ind_keep_case_label;
Karsten Hopp 1c310d
+     int		b_ind_hash_comment;
Karsten Hopp 1c310d
+     int		b_ind_cpp_namespace;
Karsten Hopp 1c310d
+     int		b_ind_if_for_while;
Karsten Hopp 1c310d
+ #endif
Karsten Hopp 1c310d
+ 
Karsten Hopp 1c310d
      linenr_T	b_no_eol_lnum;	/* non-zero lnum when last line of next binary
Karsten Hopp 1c310d
  				 * write should not have an end-of-line */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/option.c	2013-07-17 21:39:13.000000000 +0200
Karsten Hopp 1c310d
--- src/option.c	2013-11-05 06:58:04.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 5372,5377 ****
Karsten Hopp 1c310d
--- 5372,5378 ----
Karsten Hopp 1c310d
  #ifdef FEAT_CINDENT
Karsten Hopp 1c310d
      check_string_option(&buf->b_p_cink);
Karsten Hopp 1c310d
      check_string_option(&buf->b_p_cino);
Karsten Hopp 1c310d
+     parse_cino(buf);
Karsten Hopp 1c310d
  #endif
Karsten Hopp 1c310d
  #ifdef FEAT_AUTOCMD
Karsten Hopp 1c310d
      check_string_option(&buf->b_p_ft);
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 6990,6995 ****
Karsten Hopp 1c310d
--- 6991,7005 ----
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
  #endif
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
+ #ifdef FEAT_CINDENT
Karsten Hopp 1c310d
+     /* 'cinoptions' */
Karsten Hopp 1c310d
+     else if (gvarp == &p_cino)
Karsten Hopp 1c310d
+     {
Karsten Hopp 1c310d
+ 	/* TODO: recognize errors */
Karsten Hopp 1c310d
+ 	parse_cino(curbuf);
Karsten Hopp 1c310d
+     }
Karsten Hopp 1c310d
+ #endif
Karsten Hopp 1c310d
+ 
Karsten Hopp 1c310d
      /* Options that are a list of flags. */
Karsten Hopp 1c310d
      else
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 8338,8351 ****
Karsten Hopp 1c310d
  	    curwin->w_p_fdc = 12;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
      /* 'shiftwidth' or 'tabstop' */
Karsten Hopp 1c310d
      else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
  	if (foldmethodIsIndent(curwin))
Karsten Hopp 1c310d
  	    foldUpdateAll(curwin);
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
! #endif /* FEAT_FOLDING */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  #ifdef FEAT_MBYTE
Karsten Hopp 1c310d
      /* 'maxcombine' */
Karsten Hopp 1c310d
--- 8348,8371 ----
Karsten Hopp 1c310d
  	    curwin->w_p_fdc = 12;
Karsten Hopp 1c310d
  	}
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
+ #endif /* FEAT_FOLDING */
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
+ #if defined(FEAT_FOLDING) || defined(FEAT_CINDENT)
Karsten Hopp 1c310d
      /* 'shiftwidth' or 'tabstop' */
Karsten Hopp 1c310d
      else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
Karsten Hopp 1c310d
      {
Karsten Hopp 1c310d
+ # ifdef FEAT_FOLDING
Karsten Hopp 1c310d
  	if (foldmethodIsIndent(curwin))
Karsten Hopp 1c310d
  	    foldUpdateAll(curwin);
Karsten Hopp 1c310d
+ # endif
Karsten Hopp 1c310d
+ # ifdef FEAT_CINDENT
Karsten Hopp 1c310d
+ 	/* When 'shiftwidth' changes, or it's zero and 'tabstop' changes:
Karsten Hopp 1c310d
+ 	 * parse 'cinoptions'. */
Karsten Hopp 1c310d
+ 	if (pp == &curbuf->b_p_sw || curbuf->b_p_sw == 0)
Karsten Hopp 1c310d
+ 	    parse_cino(curbuf);
Karsten Hopp 1c310d
+ # endif
Karsten Hopp 1c310d
      }
Karsten Hopp 1c310d
! #endif
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  #ifdef FEAT_MBYTE
Karsten Hopp 1c310d
      /* 'maxcombine' */
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 11729,11737 ****
Karsten Hopp 1c310d
   * 'tabstop' value when 'shiftwidth' is zero.
Karsten Hopp 1c310d
   */
Karsten Hopp 1c310d
      long
Karsten Hopp 1c310d
! get_sw_value()
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     return curbuf->b_p_sw ? curbuf->b_p_sw : curbuf->b_p_ts;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
--- 11749,11758 ----
Karsten Hopp 1c310d
   * 'tabstop' value when 'shiftwidth' is zero.
Karsten Hopp 1c310d
   */
Karsten Hopp 1c310d
      long
Karsten Hopp 1c310d
! get_sw_value(buf)
Karsten Hopp 1c310d
!     buf_T *buf;
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     return buf->b_p_sw ? buf->b_p_sw : buf->b_p_ts;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 11741,11747 ****
Karsten Hopp 1c310d
      long
Karsten Hopp 1c310d
  get_sts_value()
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     return curbuf->b_p_sts < 0 ? get_sw_value() : curbuf->b_p_sts;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
--- 11762,11768 ----
Karsten Hopp 1c310d
      long
Karsten Hopp 1c310d
  get_sts_value()
Karsten Hopp 1c310d
  {
Karsten Hopp 1c310d
!     return curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : curbuf->b_p_sts;
Karsten Hopp 1c310d
  }
Karsten Hopp 1c310d
  
Karsten Hopp 1c310d
  /*
Karsten Hopp 1c310d
*** ../vim-7.4.068/src/version.c	2013-11-04 04:57:46.000000000 +0100
Karsten Hopp 1c310d
--- src/version.c	2013-11-05 04:55:36.000000000 +0100
Karsten Hopp 1c310d
***************
Karsten Hopp 1c310d
*** 740,741 ****
Karsten Hopp 1c310d
--- 740,743 ----
Karsten Hopp 1c310d
  {   /* Add new patch number below this line */
Karsten Hopp 1c310d
+ /**/
Karsten Hopp 1c310d
+     69,
Karsten Hopp 1c310d
  /**/
Karsten Hopp 1c310d
Karsten Hopp 1c310d
-- 
Karsten Hopp 1c310d
A special cleaning ordinance bans housewives from hiding dirt and dust under a
Karsten Hopp 1c310d
rug in a dwelling.
Karsten Hopp 1c310d
		[real standing law in Pennsylvania, United States of America]
Karsten Hopp 1c310d
Karsten Hopp 1c310d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1c310d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1c310d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 1c310d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///