]> git.pld-linux.org Git - packages/vim.git/blame - 7.3.178
- new
[packages/vim.git] / 7.3.178
CommitLineData
bb987377
ER
1To: vim_dev@googlegroups.com
2Subject: Patch 7.3.178
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.3.178
11Problem: C-indent doesn't handle code right after { correctly.
12Solution: Fix detecting unterminated line. (Lech Lorens)
13Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
14
15
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
18***************
19*** 4983,4989 ****
20 }
21
22 /*
23! * Return TRUE if there there is no code at *s. White space and comments are
24 * not considered code.
25 */
26 static int
27--- 4983,4989 ----
28 }
29
30 /*
31! * Return TRUE if there is no code at *s. White space and comments are
32 * not considered code.
33 */
34 static int
35***************
36*** 5458,5465 ****
37 }
38
39 /*
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).
44 */
45--- 5458,5468 ----
46 }
47
48 /*
49! * Recognize a line that starts with '{' or '}', or ends with ';', ',', '{' or
50! * '}'.
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).
56 */
57***************
58*** 5470,5475 ****
59--- 5473,5479 ----
60 int incl_comma; /* recognize a trailing comma */
61 {
62 char_u found_start = 0;
63+ unsigned n_open = 0;
64
65 s = cin_skipcomment(s);
66
67***************
68*** 5480,5489 ****
69 {
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 == ','))
74 && cin_nocode(s + 1))
75 return *s;
76
77 if (*s)
78 s++;
79--- 5484,5502 ----
80 {
81 /* skip over comments, "" strings and 'c'haracters */
82 s = skip_string(cin_skipcomment(s));
83! if (*s == '}' && n_open > 0)
84! --n_open;
85! if (n_open == 0
86! && (*s == ';' || *s == '}' || (incl_comma && *s == ','))
87 && cin_nocode(s + 1))
88 return *s;
89+ else if (*s == '{')
90+ {
91+ if (incl_open && cin_nocode(s + 1))
92+ return *s;
93+ else
94+ ++n_open;
95+ }
96
97 if (*s)
98 s++;
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
101***************
102*** 1344,1349 ****
103--- 1344,1365 ----
104 }
105
106 STARTTEST
107+ :set cino&
108+ 2kdd=][
109+ ENDTEST
110+
111+ void func(void)
112+ {
113+ if(x==y)
114+ if(y==z)
115+ foo=1;
116+ else { bar=1;
117+ baz=2;
118+ }
119+ printf("Foo!\n");
120+ }
121+
122+ STARTTEST
123 :g/^STARTTEST/.,/^ENDTEST/d
124 :1;/start of AUTO/,$wq! test.out
125 ENDTEST
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
128***************
129*** 1204,1206 ****
130--- 1204,1218 ----
131 {
132 }
133
134+
135+ void func(void)
136+ {
137+ if(x==y)
138+ if(y==z)
139+ foo=1;
140+ else { bar=1;
141+ baz=2;
142+ }
143+ printf("Foo!\n");
144+ }
145+
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
148***************
149*** 716,717 ****
150--- 716,719 ----
151 { /* Add new patch number below this line */
152+ /**/
153+ 178,
154 /**/
155
156--
157hundred-and-one symptoms of being an internet addict:
15869. Yahoo welcomes you with your own start page
159
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 ///
This page took 0.045843 seconds and 4 git commands to generate.