1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: C-indenting: a preprocessor statement confuses detection of a
13 Solution: Ignore preprocessor lines. (Lech Lorens) Also recognize the style
14 to put a comma before the argument name.
15 Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
18 *** ../vim-7.3.163/src/misc1.c 2011-04-11 16:56:29.000000000 +0200
19 --- src/misc1.c 2011-04-28 12:49:55.000000000 +0200
34 ! if (*skipwhite(s) == '#')
44 + /* Ignore line starting with #. */
45 + if (cin_ispreproc(s))
48 while (*s && *s != '(' && *s != ';' && *s != '\'' && *s != '"')
50 if (cin_iscomment(s)) /* ignore comments */
56 ! if (*s == ',' && cin_nocode(s + 1))
58 ! /* ',' at the end: continue looking in the next line */
59 if (lnum >= curbuf->b_ml.ml_line_count)
64 else if (cin_iscomment(s)) /* ignore comments */
65 s = cin_skipcomment(s);
70 ! if ((*s == ',' && cin_nocode(s + 1)) || s[1] == NUL || cin_nocode(s))
72 ! int comma = (*s == ',');
74 ! /* ',' at the end: continue looking in the next line.
75 ! * At the end: check for ',' in the next line, for this style:
80 ! if (lnum >= curbuf->b_ml.ml_line_count)
83 ! if (!cin_ispreproc(s))
86 if (lnum >= curbuf->b_ml.ml_line_count)
88 ! /* Require a comma at end of the line or a comma or ')' at the
89 ! * start of next line. */
91 ! if (!comma && *s != ',' && *s != ')')
94 else if (cin_iscomment(s)) /* ignore comments */
95 s = cin_skipcomment(s);
96 *** ../vim-7.3.163/src/testdir/test3.in 2010-08-15 21:57:29.000000000 +0200
97 --- src/testdir/test3.in 2011-04-28 12:15:12.000000000 +0200
133 :g/^STARTTEST/.,/^ENDTEST/d
134 :1;/start of AUTO/,$wq! test.out
136 *** ../vim-7.3.163/src/testdir/test3.ok 2010-08-15 21:57:29.000000000 +0200
137 --- src/testdir/test3.ok 2011-04-28 12:54:04.000000000 +0200
165 *** ../vim-7.3.163/src/version.c 2011-04-28 12:56:57.000000000 +0200
166 --- src/version.c 2011-04-28 12:59:55.000000000 +0200
170 { /* Add new patch number below this line */
176 Due knot trussed yore spell chequer two fined awl miss steaks.
178 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
179 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
180 \\\ an exciting new programming language -- http://www.Zimbu.org ///
181 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///