]>
Commit | Line | Data |
---|---|---|
59ab3540 AM |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.332 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.332 (after 7.3.202) | |
11 | Problem: Indent after "public:" is not increased in C++ code. (Lech Lorens) | |
12 | Solution: Check for namespace after the regular checks. (partly by Martin | |
13 | Gieseking) | |
14 | Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok | |
15 | ||
16 | ||
17 | *** ../vim-7.3.331/src/misc1.c 2011-09-07 19:58:04.000000000 +0200 | |
18 | --- src/misc1.c 2011-10-04 17:59:52.000000000 +0200 | |
19 | *************** | |
20 | *** 6389,6394 **** | |
21 | --- 6389,6395 ---- | |
22 | int lookfor_cpp_namespace = FALSE; | |
23 | int cont_amount = 0; /* amount for continuation line */ | |
24 | int original_line_islabel; | |
25 | + int added_to_amount = 0; | |
26 | ||
27 | for (options = curbuf->b_p_cino; *options; ) | |
28 | { | |
29 | *************** | |
30 | *** 7216,7267 **** | |
31 | else | |
32 | amount += ind_continuation; | |
33 | } | |
34 | ! else if (lookfor_cpp_namespace) | |
35 | { | |
36 | ! if (curwin->w_cursor.lnum == ourscope) | |
37 | ! continue; | |
38 | ||
39 | ! if (curwin->w_cursor.lnum == 0 | |
40 | ! || curwin->w_cursor.lnum | |
41 | < ourscope - FIND_NAMESPACE_LIM) | |
42 | ! break; | |
43 | ||
44 | ! l = ml_get_curline(); | |
45 | ||
46 | ! /* | |
47 | ! * If we're in a comment now, skip to the start of the | |
48 | ! * comment. | |
49 | ! */ | |
50 | ! trypos = find_start_comment(ind_maxcomment); | |
51 | ! if (trypos != NULL) | |
52 | ! { | |
53 | ! curwin->w_cursor.lnum = trypos->lnum + 1; | |
54 | ! curwin->w_cursor.col = 0; | |
55 | ! continue; | |
56 | ! } | |
57 | ! | |
58 | ! /* | |
59 | ! * Skip preprocessor directives and blank lines. | |
60 | ! */ | |
61 | ! if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum)) | |
62 | ! continue; | |
63 | ||
64 | ! if (cin_is_cpp_namespace(l)) | |
65 | ! { | |
66 | ! amount += ind_cpp_namespace; | |
67 | ! break; | |
68 | ! } | |
69 | ||
70 | ! if (cin_nocode(l)) | |
71 | ! continue; | |
72 | ||
73 | ! } | |
74 | ! else if (lookfor != LOOKFOR_TERM | |
75 | ! && lookfor != LOOKFOR_CPP_BASECLASS) | |
76 | ! { | |
77 | ! amount = scope_amount; | |
78 | ! if (theline[0] == '{') | |
79 | ! amount += ind_open_extra; | |
80 | } | |
81 | break; | |
82 | } | |
83 | --- 7217,7275 ---- | |
84 | else | |
85 | amount += ind_continuation; | |
86 | } | |
87 | ! else | |
88 | { | |
89 | ! if (lookfor != LOOKFOR_TERM | |
90 | ! && lookfor != LOOKFOR_CPP_BASECLASS) | |
91 | ! { | |
92 | ! amount = scope_amount; | |
93 | ! if (theline[0] == '{') | |
94 | ! { | |
95 | ! amount += ind_open_extra; | |
96 | ! added_to_amount = ind_open_extra; | |
97 | ! } | |
98 | ! } | |
99 | ||
100 | ! if (lookfor_cpp_namespace) | |
101 | ! { | |
102 | ! /* | |
103 | ! * Looking for C++ namespace, need to look further | |
104 | ! * back. | |
105 | ! */ | |
106 | ! if (curwin->w_cursor.lnum == ourscope) | |
107 | ! continue; | |
108 | ! | |
109 | ! if (curwin->w_cursor.lnum == 0 | |
110 | ! || curwin->w_cursor.lnum | |
111 | < ourscope - FIND_NAMESPACE_LIM) | |
112 | ! break; | |
113 | ||
114 | ! l = ml_get_curline(); | |
115 | ||
116 | ! /* If we're in a comment now, skip to the start of | |
117 | ! * the comment. */ | |
118 | ! trypos = find_start_comment(ind_maxcomment); | |
119 | ! if (trypos != NULL) | |
120 | ! { | |
121 | ! curwin->w_cursor.lnum = trypos->lnum + 1; | |
122 | ! curwin->w_cursor.col = 0; | |
123 | ! continue; | |
124 | ! } | |
125 | ||
126 | ! /* Skip preprocessor directives and blank lines. */ | |
127 | ! if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum)) | |
128 | ! continue; | |
129 | ||
130 | ! /* Finally the actual check for "namespace". */ | |
131 | ! if (cin_is_cpp_namespace(l)) | |
132 | ! { | |
133 | ! amount += ind_cpp_namespace - added_to_amount; | |
134 | ! break; | |
135 | ! } | |
136 | ||
137 | ! if (cin_nocode(l)) | |
138 | ! continue; | |
139 | ! } | |
140 | } | |
141 | break; | |
142 | } | |
143 | *** ../vim-7.3.331/src/testdir/test3.in 2011-07-20 15:09:38.000000000 +0200 | |
144 | --- src/testdir/test3.in 2011-10-04 17:45:20.000000000 +0200 | |
145 | *************** | |
146 | *** 1309,1314 **** | |
147 | --- 1309,1328 ---- | |
148 | }; | |
149 | ||
150 | STARTTEST | |
151 | + :set cino=(0,gs,hs | |
152 | + 2kdd]]=][ | |
153 | + ENDTEST | |
154 | + | |
155 | + class Foo : public Bar | |
156 | + { | |
157 | + public: | |
158 | + virtual void method1(void) = 0; | |
159 | + virtual void method2(int arg1, | |
160 | + int arg2, | |
161 | + int arg3) = 0; | |
162 | + }; | |
163 | + | |
164 | + STARTTEST | |
165 | :set cino=+20 | |
166 | 2kdd]]=][ | |
167 | ENDTEST | |
168 | *** ../vim-7.3.331/src/testdir/test3.ok 2011-07-20 15:09:38.000000000 +0200 | |
169 | --- src/testdir/test3.ok 2011-10-04 17:47:25.000000000 +0200 | |
170 | *************** | |
171 | *** 1190,1195 **** | |
172 | --- 1190,1205 ---- | |
173 | }; | |
174 | ||
175 | ||
176 | + class Foo : public Bar | |
177 | + { | |
178 | + public: | |
179 | + virtual void method1(void) = 0; | |
180 | + virtual void method2(int arg1, | |
181 | + int arg2, | |
182 | + int arg3) = 0; | |
183 | + }; | |
184 | + | |
185 | + | |
186 | void | |
187 | foo() | |
188 | { | |
189 | *** ../vim-7.3.331/src/version.c 2011-10-04 17:00:13.000000000 +0200 | |
190 | --- src/version.c 2011-10-04 18:02:17.000000000 +0200 | |
191 | *************** | |
192 | *** 711,712 **** | |
193 | --- 711,714 ---- | |
194 | { /* Add new patch number below this line */ | |
195 | + /**/ | |
196 | + 332, | |
197 | /**/ | |
198 | ||
199 | -- | |
200 | Latest survey shows that 3 out of 4 people make up 75% of the | |
201 | world's population. | |
202 | ||
203 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
204 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
205 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
206 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |