xiancode / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

[patch] cindent: array contents followed by a closing brace and a semicolon confuses the indenter #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Try indenting a file with the following contents:
#v+
// vim: cindent et

void func(void)
{
        int a[] =
        {
                1, 2,
                3, 4};
        printf("This is indented too much!\n");
}
#v-

Currently Vim indents printf too much:
#v+
// vim: cindent et

void func(void)
{
        int a[] =
        {
                1, 2,
                3, 4};
                printf("This is indented too much!\n");
}
#v-

I am attaching a patch which fixes the problem. The patch also contains a test 
for the situation described above. While trying to fix the problem at one point 
I caused Vim to behave incorrectly while indenting a switch block. The 
incorrect behaviour was not detected by the test suite so I am also adding a 
test for switch.

Original issue reported on code.google.com by lech.lor...@gmail.com on 12 Jun 2011 at 11:32

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by lech.lor...@gmail.com on 15 Aug 2011 at 1:22