jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.069

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