# HG changeset patch # User Bram Moolenaar # Date 1310731950 -7200 # Node ID 9f71f5a526aff4f1e0eefe1068d9534aee427afa # Parent e87a2f7c97feff83c45ef29476961ac0d116fe30 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 --- 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 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1452,6 +1452,36 @@ printf("Don't you dare indent this line 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=][ ENDTEST diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -1310,6 +1310,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" << "b" << ") :" diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -710,6 +710,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 249, +/**/ 248, /**/ 247,