changeset 2953:9f71f5a526af v7.3.249

updated for version 7.3.249 Problem: Wrong indenting for array initializer. Solution: Detect '}' in a better way. (Lech Lorens)
author Bram Moolenaar <bram@vim.org>
date Fri, 15 Jul 2011 14:12:30 +0200
parents e87a2f7c97fe
children 12bd7c8b3ab7
files src/misc1.c src/testdir/test3.in src/testdir/test3.ok src/version.c
diffstat 4 files changed, 58 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 */
 			{
--- 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
 
--- 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"
 		<< ") :"
--- 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,