jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.069

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