]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.363 v7.3.363
authorBram Moolenaar <Bram@vim.org>
Wed, 30 Nov 2011 16:20:23 +0000 (17:20 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 30 Nov 2011 16:20:23 +0000 (17:20 +0100)
Problem:    C indenting is wrong after #endif followed by a semicolon.
Solution:   Add special handling for a semicolon in a line by itself. (Lech
            Lorens)

src/misc1.c
src/testdir/test3.in
src/testdir/test3.ok
src/version.c

index d260b0c2aab92a4c8afbe32d112ec661bc0fb92d..11a1f94fa8f6a3b65550974f30152bbf27f46d94 100644 (file)
@@ -8142,6 +8142,29 @@ term_again:
                if (cin_ends_in(l, (char_u *)"};", NULL))
                    break;
 
+               /*
+                * Find a line only has a semicolon that belongs to a previous
+                * line ending in '}', e.g. before an #endif.  Don't increase
+                * indent then.
+                */
+               if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1))
+               {
+                   pos_T curpos_save = curwin->w_cursor;
+
+                   while (curwin->w_cursor.lnum > 1)
+                   {
+                       look = ml_get(--curwin->w_cursor.lnum);
+                       if (!(cin_nocode(look) || cin_ispreproc_cont(
+                                             &look, &curwin->w_cursor.lnum)))
+                           break;
+                   }
+                   if (curwin->w_cursor.lnum > 0
+                                   && cin_ends_in(look, (char_u *)"}", NULL))
+                       break;
+
+                   curwin->w_cursor = curpos_save;
+               }
+
                /*
                 * If the PREVIOUS line is a function declaration, the current
                 * line (and the ones that follow) needs to be indented as
index f987478f62064eab4600a463266bccba4af84ee0..d3911427dd3ddf434488be8e8b427fc8db782938 100644 (file)
@@ -1454,6 +1454,16 @@ void func2(void)
                printf("This line used to be indented incorrectly.\n");
 }
 
+int foo[]
+#ifdef BAR
+
+= { 1, 2, 3,
+       4, 5, 6 }
+
+#endif
+;
+       int baz;
+
 void func3(void)
 {
        int tab[] = {
index c95b1884647fdd34396374420bd2460afe5e5b71..3c07366463cbdf4364d2dd4ef18104d9ff61fcd7 100644 (file)
@@ -1307,6 +1307,16 @@ void func2(void)
        printf("This line used to be indented incorrectly.\n");
 }
 
+int foo[]
+#ifdef BAR
+
+= { 1, 2, 3,
+       4, 5, 6 }
+
+#endif
+       ;
+int baz;
+
 void func3(void)
 {
        int tab[] = {
index 99d6a79af925087b7c0e2190b03c9c989ce7f82a..4719ffc5ab4eb4f659063614705441a972c11bd4 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    363,
 /**/
     362,
 /**/