]> granicus.if.org Git - vim/commitdiff
patch 8.0.1291: C indent wrong when * immediately follows comment v8.0.1291
authorBram Moolenaar <Bram@vim.org>
Sun, 12 Nov 2017 14:36:38 +0000 (15:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 12 Nov 2017 14:36:38 +0000 (15:36 +0100)
Problem:    C indent wrong when * immediately follows comment. (John Bowler)
Solution:   Do not see "/*" after "*" as a comment start. (closes #2321)

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

index 25c2e6e77459535a3a3820dbec7f8ba76f64259b..fc689db2df60804900adbb7b41ce08b3f998dbeb 100644 (file)
@@ -2280,7 +2280,7 @@ findmatchlimit(
            {
                /*
                 * A comment may contain / * or / /, it may also start or end
-                * with / * /.  Ignore a / * after / /.
+                * with / * /.  Ignore a / * after / / and after *.
                 */
                if (pos.col == 0)
                    continue;
@@ -2306,6 +2306,7 @@ findmatchlimit(
                }
                else if (  linep[pos.col - 1] == '/'
                        && linep[pos.col] == '*'
+                       && (pos.col == 1 || linep[pos.col - 2] != '*')
                        && (int)pos.col < comment_col)
                {
                    count++;
index c78a66ec131a1c18622fcd0590f835d71b47ad69..646fbb35c3516eb82f6b7f2ed5a3e820dab7c074 100644 (file)
@@ -2338,6 +2338,16 @@ CCC
 4
 /* end of define */
 
+STARTTEST
+:set cin cino&
+/a = second
+ox\e
+ENDTEST
+
+{
+       a = second/*bug*/*line;
+}
+
 STARTTEST
 :g/^STARTTEST/.,/^ENDTEST/d
 :1;/start of AUTO/,$wq! test.out
index cfb519bdf4c6f285741aa3e15e1f2e9d237ecb12..035ea39999627a4091ea0c6e42a14838b043ed23 100644 (file)
@@ -2094,3 +2094,9 @@ JSEND
        4
 /* end of define */
 
+
+{
+       a = second/*bug*/*line;
+       x
+}
+
index 949320cca4b51f99ba4b9dfa977e87d22f746998..912808b0503578ccdbbce69350872b95db511acd 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1291,
 /**/
     1290,
 /**/