Skip to content

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

Description

@GoogleCodeExporter
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 [email protected] on 12 Jun 2011 at 11:32

Attachments:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions