]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1426: indent wrong after "export namespace" in C++ v9.0.1426
authorVirginia Senioria <91khr@users.noreply.github.com>
Fri, 24 Mar 2023 19:25:06 +0000 (19:25 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 24 Mar 2023 19:25:06 +0000 (19:25 +0000)
Problem:    Indent wrong after "export namespace" in C++.
Solution:   Skip over "inline" and "export" in any order. (Virginia Senioria,
            closes #12134, closes #12133)

src/cindent.c
src/testdir/test_cindent.vim
src/version.c

index e8e255feb35f76b0e46f6127a1e595afa41d8295..176bc05282c0acabcdad2a1fa1b38a144930eef9 100644 (file)
@@ -769,7 +769,9 @@ cin_is_cpp_namespace(char_u *s)
 
     s = cin_skipcomment(s);
 
-    if (STRNCMP(s, "inline", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6])))
+    // skip over "inline" and "export" in any order
+    while ((STRNCMP(s, "inline", 6) == 0 || STRNCMP(s, "export", 6) == 0)
+                                       && (s[6] == NUL || !vim_iswordc(s[6])))
        s = cin_skipcomment(skipwhite(s + 6));
 
     if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9])))
index 96e99ac71c7afa6246cd4c4433711c01081a6207..d27adbc4b51dc4e7da1ed5c347e3ae02c697ba13 100644 (file)
@@ -4406,6 +4406,18 @@ def Test_cindent_47()
   inline/* test */namespace {
     111111111111111111;
   }
+  export namespace {
+    111111111111111111;
+  }
+  export inline namespace {
+    111111111111111111;
+  }
+  export/* test */inline namespace {
+    111111111111111111;
+  }
+  inline export namespace {
+    111111111111111111;
+  }
 
   /* invalid namespaces use block indent */
   namespace test test2 {
@@ -4509,6 +4521,18 @@ def Test_cindent_47()
   inline/* test */namespace {
   111111111111111111;
   }
+  export namespace {
+  111111111111111111;
+  }
+  export inline namespace {
+  111111111111111111;
+  }
+  export/* test */inline namespace {
+  111111111111111111;
+  }
+  inline export namespace {
+  111111111111111111;
+  }
 
   /* invalid namespaces use block indent */
   namespace test test2 {
index 63428d309584fedd2e2a9625e02ba75e30b167a3..f44e29c5e4e432713841a904e9c82180af67e922 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1426,
 /**/
     1425,
 /**/