From: Bram Moolenaar Date: Fri, 15 Jul 2011 12:12:30 +0000 (+0200) Subject: updated for version 7.3.249 X-Git-Tag: v7.3.249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50f42cadb1a5970d3a6b83d961e66fa486df8fcb;p=vim updated for version 7.3.249 Problem: Wrong indenting for array initializer. Solution: Detect '}' in a better way. (Lech Lorens) --- diff --git a/src/misc1.c b/src/misc1.c index d69f12fd2..c7f2f8059 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -7945,8 +7945,7 @@ term_again: * If we're at the end of a block, skip to the start of * that block. */ - curwin->w_cursor.col = 0; - if (*cin_skipcomment(l) == '}' + if (find_last_paren(l, '{', '}') && (trypos = find_start_brace(ind_maxcomment)) != NULL) /* XXX */ { diff --git a/src/testdir/test3.in b/src/testdir/test3.in index 1cfd8f23e..aea055fb3 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1450,6 +1450,36 @@ void func3(void) printf("Don't you dare indent this line incorrectly!\n); } +STARTTEST +:set cino& +:set cino+=l1 +2kdd=][ +ENDTEST + +void func(void) +{ + int tab[] = + { + 1, 2, 3, + 4, 5, 6}; + + printf("Indent this line correctly!\n"); + + switch (foo) + { + case bar: + printf("bar"); + break; + case baz: { + printf("baz"); + break; + } + case quux: +printf("But don't break the indentation of this instruction\n"); +break; + } +} + STARTTEST :set cino& 2kdd=][ diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 8475aff9f..a47566931 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -1308,6 +1308,31 @@ void func3(void) } +void func(void) +{ + int tab[] = + { + 1, 2, 3, + 4, 5, 6}; + + printf("Indent this line correctly!\n"); + + switch (foo) + { + case bar: + printf("bar"); + break; + case baz: { + printf("baz"); + break; + } + case quux: + printf("But don't break the indentation of this instruction\n"); + break; + } +} + + void func(void) { cout << "a" diff --git a/src/version.c b/src/version.c index a501f5e14..a13868106 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 249, /**/ 248, /**/