diff options
-rw-r--r-- | src/nvim/indent_c.c | 4 | ||||
-rw-r--r-- | test/old/testdir/test_cindent.vim | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 3e7f640326..f7bf9c46a4 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -525,7 +525,9 @@ static bool cin_is_cpp_namespace(const char *s) s = cin_skipcomment(s); - if (strncmp(s, "inline", 6) == 0 && (s[6] == NUL || !vim_iswordc((uint8_t)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((uint8_t)s[6]))) { s = cin_skipcomment(skipwhite(s + 6)); } diff --git a/test/old/testdir/test_cindent.vim b/test/old/testdir/test_cindent.vim index ccc8168c09..d9702f57d2 100644 --- a/test/old/testdir/test_cindent.vim +++ b/test/old/testdir/test_cindent.vim @@ -4392,6 +4392,18 @@ func 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 { @@ -4495,6 +4507,18 @@ func 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 { |