summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-07-15 14:12:30 +0200
committerBram Moolenaar <Bram@vim.org>2011-07-15 14:12:30 +0200
commit50f42cadb1a5970d3a6b83d961e66fa486df8fcb (patch)
treebcdbc21d3f7bed8e47f9f201e304d480f76f461a
parent734d99804b42638ff25480dd8f8f477f2809cc7e (diff)
updated for version 7.3.249v7.3.249
Problem: Wrong indenting for array initializer. Solution: Detect '}' in a better way. (Lech Lorens)
-rw-r--r--src/misc1.c3
-rw-r--r--src/testdir/test3.in30
-rw-r--r--src/testdir/test3.ok25
-rw-r--r--src/version.c2
4 files changed, 58 insertions, 2 deletions
diff --git a/src/misc1.c b/src/misc1.c
index d69f12fd29..c7f2f80596 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 1cfd8f23ee..aea055fb3a 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -1452,6 +1452,36 @@ 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=][
ENDTEST
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index 8475aff9fe..a475669310 100644
--- 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
index a501f5e14a..a138681069 100644
--- 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,