Skip to content

Commit ddc0146

Browse files
committed
updated for version 7.3.249
Problem: Wrong indenting for array initializer. Solution: Detect '}' in a better way. (Lech Lorens)
1 parent 1f1e419 commit ddc0146

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

src/misc1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7945,8 +7945,7 @@ get_c_indent()
79457945
* If we're at the end of a block, skip to the start of
79467946
* that block.
79477947
*/
7948-
curwin->w_cursor.col = 0;
7949-
if (*cin_skipcomment(l) == '}'
7948+
if (find_last_paren(l, '{', '}')
79507949
&& (trypos = find_start_brace(ind_maxcomment))
79517950
!= NULL) /* XXX */
79527951
{

src/testdir/test3.in

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,36 @@ void func3(void)
14501450
printf("Don't you dare indent this line incorrectly!\n);
14511451
}
14521452

1453+
STARTTEST
1454+
:set cino&
1455+
:set cino+=l1
1456+
2kdd=][
1457+
ENDTEST
1458+
1459+
void func(void)
1460+
{
1461+
int tab[] =
1462+
{
1463+
1, 2, 3,
1464+
4, 5, 6};
1465+
1466+
printf("Indent this line correctly!\n");
1467+
1468+
switch (foo)
1469+
{
1470+
case bar:
1471+
printf("bar");
1472+
break;
1473+
case baz: {
1474+
printf("baz");
1475+
break;
1476+
}
1477+
case quux:
1478+
printf("But don't break the indentation of this instruction\n");
1479+
break;
1480+
}
1481+
}
1482+
14531483
STARTTEST
14541484
:set cino&
14551485
2kdd=][

src/testdir/test3.ok

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,31 @@ void func3(void)
13081308
}
13091309

13101310

1311+
void func(void)
1312+
{
1313+
int tab[] =
1314+
{
1315+
1, 2, 3,
1316+
4, 5, 6};
1317+
1318+
printf("Indent this line correctly!\n");
1319+
1320+
switch (foo)
1321+
{
1322+
case bar:
1323+
printf("bar");
1324+
break;
1325+
case baz: {
1326+
printf("baz");
1327+
break;
1328+
}
1329+
case quux:
1330+
printf("But don't break the indentation of this instruction\n");
1331+
break;
1332+
}
1333+
}
1334+
1335+
13111336
void func(void)
13121337
{
13131338
cout << "a"

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ static char *(features[]) =
709709

710710
static int included_patches[] =
711711
{ /* Add new patch number below this line */
712+
/**/
713+
249,
712714
/**/
713715
248,
714716
/**/

0 commit comments

Comments
 (0)