From 99e4ab2a1e577ddb29030c09c308b67e16fd51c4 Mon Sep 17 00:00:00 2001 From: Virginia Senioria <91khr@users.noreply.github.com> Date: Fri, 24 Mar 2023 19:25:06 +0000 Subject: patch 9.0.1426: indent wrong after "export namespace" in C++ 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 | 4 +++- src/testdir/test_cindent.vim | 24 ++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) 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 @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1426, /**/ 1425, /**/ -- cgit v1.2.1