Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 10 by [email protected]: [patch] cindent: array contents followed by a closing brace and a semicolon confuses the indenter
http://code.google.com/p/vim/issues/detail?id=10

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.

Attachments:
        c-indent-array-contents-brace-semicolon.patch  1.6 KB

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui