]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.332 v7.3.332
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Oct 2011 16:03:47 +0000 (18:03 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Oct 2011 16:03:47 +0000 (18:03 +0200)
Problem:    Indent after "public:" is not increased in C++ code. (Lech Lorens)
Solution:   Check for namespace after the regular checks. (partly by Martin
            Gieseking)

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

index 589a145cc5d5ad5d189fcb1cfc6de28f870564ca..95b45479c33a1aa8bfdde64446b18cf52b4f91f8 100644 (file)
@@ -6389,6 +6389,7 @@ get_c_indent()
     int                lookfor_cpp_namespace = FALSE;
     int                cont_amount = 0;    /* amount for continuation line */
     int                original_line_islabel;
+    int                added_to_amount = 0;
 
     for (options = curbuf->b_p_cino; *options; )
     {
@@ -7216,52 +7217,59 @@ get_c_indent()
                        else
                            amount += ind_continuation;
                    }
-                   else if (lookfor_cpp_namespace)
+                   else
                    {
-                       if (curwin->w_cursor.lnum == ourscope)
-                           continue;
+                       if (lookfor != LOOKFOR_TERM
+                                         && lookfor != LOOKFOR_CPP_BASECLASS)
+                       {
+                           amount = scope_amount;
+                           if (theline[0] == '{')
+                           {
+                               amount += ind_open_extra;
+                               added_to_amount = ind_open_extra;
+                           }
+                       }
 
-                       if (curwin->w_cursor.lnum == 0
-                               || curwin->w_cursor.lnum
-                                             < ourscope - FIND_NAMESPACE_LIM)
-                           break;
+                       if (lookfor_cpp_namespace)
+                       {
+                           /*
+                            * Looking for C++ namespace, need to look further
+                            * back.
+                            */
+                           if (curwin->w_cursor.lnum == ourscope)
+                               continue;
 
-                       l = ml_get_curline();
+                           if (curwin->w_cursor.lnum == 0
+                                   || curwin->w_cursor.lnum
+                                             < ourscope - FIND_NAMESPACE_LIM)
+                               break;
 
-                       /*
-                        * If we're in a comment now, skip to the start of the
-                        * comment.
-                        */
-                       trypos = find_start_comment(ind_maxcomment);
-                       if (trypos != NULL)
-                       {
-                           curwin->w_cursor.lnum = trypos->lnum + 1;
-                           curwin->w_cursor.col = 0;
-                           continue;
-                       }
+                           l = ml_get_curline();
 
-                       /*
-                        * Skip preprocessor directives and blank lines.
-                        */
-                       if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
-                           continue;
+                           /* If we're in a comment now, skip to the start of
+                            * the comment. */
+                           trypos = find_start_comment(ind_maxcomment);
+                           if (trypos != NULL)
+                           {
+                               curwin->w_cursor.lnum = trypos->lnum + 1;
+                               curwin->w_cursor.col = 0;
+                               continue;
+                           }
 
-                       if (cin_is_cpp_namespace(l))
-                       {
-                           amount += ind_cpp_namespace;
-                           break;
-                       }
+                           /* Skip preprocessor directives and blank lines. */
+                           if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
+                               continue;
 
-                       if (cin_nocode(l))
-                           continue;
+                           /* Finally the actual check for "namespace". */
+                           if (cin_is_cpp_namespace(l))
+                           {
+                               amount += ind_cpp_namespace - added_to_amount;
+                               break;
+                           }
 
-                   }
-                   else if (lookfor != LOOKFOR_TERM
-                                         && lookfor != LOOKFOR_CPP_BASECLASS)
-                   {
-                       amount = scope_amount;
-                       if (theline[0] == '{')
-                           amount += ind_open_extra;
+                           if (cin_nocode(l))
+                               continue;
+                       }
                    }
                    break;
                }
index 55ca2a5a7a26cb38dd69ec6d76715d9cd058ecde..f987478f62064eab4600a463266bccba4af84ee0 100644 (file)
@@ -1308,6 +1308,20 @@ protected:
    void testfall();
 };
 
+STARTTEST
+:set cino=(0,gs,hs
+2kdd]]=][
+ENDTEST
+
+class Foo : public Bar
+{
+public:
+virtual void method1(void) = 0;
+virtual void method2(int arg1,
+int arg2,
+int arg3) = 0;
+};
+
 STARTTEST
 :set cino=+20
 2kdd]]=][
index 396230744211c15e12239f23cbe1476e17a97ef4..c95b1884647fdd34396374420bd2460afe5e5b71 100644 (file)
@@ -1190,6 +1190,16 @@ protected:
 };
 
 
+class Foo : public Bar
+{
+       public:
+               virtual void method1(void) = 0;
+               virtual void method2(int arg1,
+                                                        int arg2,
+                                                        int arg3) = 0;
+};
+
+
        void
 foo()
 {
index 6b1676d2d3bd4756653338aaf05aca43ee9edb87..756c6366cdd50c393c245b33c146e8727e5aeaf6 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    332,
 /**/
     331,
 /**/