]>
Commit | Line | Data |
---|---|---|
c6060300 MT |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.363 | |
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.363 | |
11 | Problem: C indenting is wrong after #endif followed by a semicolon. | |
12 | Solution: Add special handling for a semicolon in a line by itself. (Lech | |
13 | Lorens) | |
14 | Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok | |
15 | ||
16 | ||
17 | *** ../vim-7.3.362/src/misc1.c 2011-11-30 13:03:24.000000000 +0100 | |
18 | --- src/misc1.c 2011-11-30 17:10:59.000000000 +0100 | |
19 | *************** | |
20 | *** 8143,8148 **** | |
21 | --- 8143,8171 ---- | |
22 | break; | |
23 | ||
24 | /* | |
25 | + * Find a line only has a semicolon that belongs to a previous | |
26 | + * line ending in '}', e.g. before an #endif. Don't increase | |
27 | + * indent then. | |
28 | + */ | |
29 | + if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1)) | |
30 | + { | |
31 | + pos_T curpos_save = curwin->w_cursor; | |
32 | + | |
33 | + while (curwin->w_cursor.lnum > 1) | |
34 | + { | |
35 | + look = ml_get(--curwin->w_cursor.lnum); | |
36 | + if (!(cin_nocode(look) || cin_ispreproc_cont( | |
37 | + &look, &curwin->w_cursor.lnum))) | |
38 | + break; | |
39 | + } | |
40 | + if (curwin->w_cursor.lnum > 0 | |
41 | + && cin_ends_in(look, (char_u *)"}", NULL)) | |
42 | + break; | |
43 | + | |
44 | + curwin->w_cursor = curpos_save; | |
45 | + } | |
46 | + | |
47 | + /* | |
48 | * If the PREVIOUS line is a function declaration, the current | |
49 | * line (and the ones that follow) needs to be indented as | |
50 | * parameters. | |
51 | *** ../vim-7.3.362/src/testdir/test3.in 2011-10-04 18:03:43.000000000 +0200 | |
52 | --- src/testdir/test3.in 2011-11-30 17:05:20.000000000 +0100 | |
53 | *************** | |
54 | *** 1454,1459 **** | |
55 | --- 1454,1469 ---- | |
56 | printf("This line used to be indented incorrectly.\n"); | |
57 | } | |
58 | ||
59 | + int foo[] | |
60 | + #ifdef BAR | |
61 | + | |
62 | + = { 1, 2, 3, | |
63 | + 4, 5, 6 } | |
64 | + | |
65 | + #endif | |
66 | + ; | |
67 | + int baz; | |
68 | + | |
69 | void func3(void) | |
70 | { | |
71 | int tab[] = { | |
72 | *** ../vim-7.3.362/src/testdir/test3.ok 2011-10-04 18:03:43.000000000 +0200 | |
73 | --- src/testdir/test3.ok 2011-11-30 17:05:20.000000000 +0100 | |
74 | *************** | |
75 | *** 1307,1312 **** | |
76 | --- 1307,1322 ---- | |
77 | printf("This line used to be indented incorrectly.\n"); | |
78 | } | |
79 | ||
80 | + int foo[] | |
81 | + #ifdef BAR | |
82 | + | |
83 | + = { 1, 2, 3, | |
84 | + 4, 5, 6 } | |
85 | + | |
86 | + #endif | |
87 | + ; | |
88 | + int baz; | |
89 | + | |
90 | void func3(void) | |
91 | { | |
92 | int tab[] = { | |
93 | *** ../vim-7.3.362/src/version.c 2011-11-30 17:01:55.000000000 +0100 | |
94 | --- src/version.c 2011-11-30 17:06:57.000000000 +0100 | |
95 | *************** | |
96 | *** 716,717 **** | |
97 | --- 716,719 ---- | |
98 | { /* Add new patch number below this line */ | |
99 | + /**/ | |
100 | + 363, | |
101 | /**/ | |
102 | ||
103 | -- | |
104 | hundred-and-one symptoms of being an internet addict: | |
105 | 220. Your wife asks for sex and you tell her where to find you on IRC. | |
106 | ||
107 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
108 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
109 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
110 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |