Commits

Bram Moolenaar  committed 9f71f5a

updated for version 7.3.249
Problem: Wrong indenting for array initializer.
Solution: Detect '}' in a better way. (Lech Lorens)

  • Participants
  • Parent commits e87a2f7
  • Tags v7-3-249

Comments (0)

Files changed (4)

 			 * 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 */
 			{

File src/testdir/test3.in

 
 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
 

File src/testdir/test3.ok

 
 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"
 		<< ") :"

File src/version.c

 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    249,
+/**/
     248,
 /**/
     247,