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