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-indent doesn't handle code right after { correctly.
12 Solution: Fix detecting unterminated line. (Lech Lorens)
13 Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
16 *** ../vim-7.3.177/src/misc1.c 2011-04-28 17:48:39.000000000 +0200
17 --- src/misc1.c 2011-05-10 11:35:09.000000000 +0200
23 ! * Return TRUE if there there is no code at *s. White space and comments are
24 * not considered code.
31 ! * Return TRUE if there is no code at *s. White space and comments are
32 * not considered code.
40 ! * Recognize a line that starts with '{' or '}', or ends with ';', '{' or '}'.
41 * Don't consider "} else" a terminated line.
42 * Return the character terminating the line (ending char's have precedence if
43 * both apply in order to determine initializations).
49 ! * Recognize a line that starts with '{' or '}', or ends with ';', ',', '{' or
51 * Don't consider "} else" a terminated line.
52 + * Don't consider a line where there are unmatched opening braces before '}',
53 + * ';' or ',' a terminated line.
54 * Return the character terminating the line (ending char's have precedence if
55 * both apply in order to determine initializations).
60 int incl_comma; /* recognize a trailing comma */
62 char_u found_start = 0;
63 + unsigned n_open = 0;
65 s = cin_skipcomment(s);
70 /* skip over comments, "" strings and 'c'haracters */
71 s = skip_string(cin_skipcomment(s));
72 ! if ((*s == ';' || (incl_open && *s == '{') || *s == '}'
73 ! || (incl_comma && *s == ','))
81 /* skip over comments, "" strings and 'c'haracters */
82 s = skip_string(cin_skipcomment(s));
83 ! if (*s == '}' && n_open > 0)
86 ! && (*s == ';' || *s == '}' || (incl_comma && *s == ','))
91 + if (incl_open && cin_nocode(s + 1))
99 *** ../vim-7.3.177/src/testdir/test3.in 2011-04-28 13:01:59.000000000 +0200
100 --- src/testdir/test3.in 2011-05-10 11:34:13.000000000 +0200
123 :g/^STARTTEST/.,/^ENDTEST/d
124 :1;/start of AUTO/,$wq! test.out
126 *** ../vim-7.3.177/src/testdir/test3.ok 2011-04-28 13:01:59.000000000 +0200
127 --- src/testdir/test3.ok 2011-05-10 11:34:13.000000000 +0200
146 *** ../vim-7.3.177/src/version.c 2011-05-05 18:31:54.000000000 +0200
147 --- src/version.c 2011-05-10 11:37:43.000000000 +0200
151 { /* Add new patch number below this line */
157 hundred-and-one symptoms of being an internet addict:
158 69. Yahoo welcomes you with your own start page
160 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
161 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
162 \\\ an exciting new programming language -- http://www.Zimbu.org ///
163 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///