summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVirginia Senioria <91khr@users.noreply.github.com>2023-03-24 19:25:06 +0000
committerBram Moolenaar <Bram@vim.org>2023-03-24 19:25:06 +0000
commit99e4ab2a1e577ddb29030c09c308b67e16fd51c4 (patch)
tree75fa4b40fe1e787efa79eb1b94dbba2a958fe4b2
parent3ea62381c527395ae701715335776f427d22eb7b (diff)
downloadvim-git-99e4ab2a1e577ddb29030c09c308b67e16fd51c4.tar.gz
patch 9.0.1426: indent wrong after "export namespace" in C++v9.0.1426
Problem: Indent wrong after "export namespace" in C++. Solution: Skip over "inline" and "export" in any order. (Virginia Senioria, closes #12134, closes #12133)
-rw-r--r--src/cindent.c4
-rw-r--r--src/testdir/test_cindent.vim24
-rw-r--r--src/version.c2
3 files changed, 29 insertions, 1 deletions
diff --git a/src/cindent.c b/src/cindent.c
index e8e255feb..176bc0528 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -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])))
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 96e99ac71..d27adbc4b 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -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 {
diff --git a/src/version.c b/src/version.c
index 63428d309..f44e29c5e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1426,
+/**/
1425,
/**/
1424,