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
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
14 Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
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
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;
27 for (options = curbuf->b_p_cino; *options; )
32 amount += ind_continuation;
34 ! else if (lookfor_cpp_namespace)
36 ! if (curwin->w_cursor.lnum == ourscope)
39 ! if (curwin->w_cursor.lnum == 0
40 ! || curwin->w_cursor.lnum
41 < ourscope - FIND_NAMESPACE_LIM)
44 ! l = ml_get_curline();
47 ! * If we're in a comment now, skip to the start of the
50 ! trypos = find_start_comment(ind_maxcomment);
53 ! curwin->w_cursor.lnum = trypos->lnum + 1;
54 ! curwin->w_cursor.col = 0;
59 ! * Skip preprocessor directives and blank lines.
61 ! if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
64 ! if (cin_is_cpp_namespace(l))
66 ! amount += ind_cpp_namespace;
74 ! else if (lookfor != LOOKFOR_TERM
75 ! && lookfor != LOOKFOR_CPP_BASECLASS)
77 ! amount = scope_amount;
78 ! if (theline[0] == '{')
79 ! amount += ind_open_extra;
85 amount += ind_continuation;
89 ! if (lookfor != LOOKFOR_TERM
90 ! && lookfor != LOOKFOR_CPP_BASECLASS)
92 ! amount = scope_amount;
93 ! if (theline[0] == '{')
95 ! amount += ind_open_extra;
96 ! added_to_amount = ind_open_extra;
100 ! if (lookfor_cpp_namespace)
103 ! * Looking for C++ namespace, need to look further
106 ! if (curwin->w_cursor.lnum == ourscope)
109 ! if (curwin->w_cursor.lnum == 0
110 ! || curwin->w_cursor.lnum
111 < ourscope - FIND_NAMESPACE_LIM)
114 ! l = ml_get_curline();
116 ! /* If we're in a comment now, skip to the start of
118 ! trypos = find_start_comment(ind_maxcomment);
119 ! if (trypos != NULL)
121 ! curwin->w_cursor.lnum = trypos->lnum + 1;
122 ! curwin->w_cursor.col = 0;
126 ! /* Skip preprocessor directives and blank lines. */
127 ! if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
130 ! /* Finally the actual check for "namespace". */
131 ! if (cin_is_cpp_namespace(l))
133 ! amount += ind_cpp_namespace - added_to_amount;
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
155 + class Foo : public Bar
158 + virtual void method1(void) = 0;
159 + virtual void method2(int arg1,
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
176 + class Foo : public Bar
179 + virtual void method1(void) = 0;
180 + virtual void method2(int arg1,
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
194 { /* Add new patch number below this line */
200 Latest survey shows that 3 out of 4 people make up 75% of the
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 ///