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