Mercurial > vim
changeset 26694:1095fd0dc362 v8.2.3876
patch 8.2.3876: 'cindent' does not recognize inline namespace
Commit: https://github.com/vim/vim/commit/f2f0bddf303e37d4d532ca22e2d53179c20b1d19
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Dec 22 20:55:30 2021 +0000
patch 8.2.3876: 'cindent' does not recognize inline namespace
Problem: 'cindent' does not recognize inline namespace.
Solution: Skip over "inline" to find "namespace". (closes https://github.com/vim/vim/issues/9383)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 22 Dec 2021 22:00:05 +0100 |
parents | 312866076d85 |
children | 221d727d6f95 |
files | src/cindent.c src/testdir/test_cindent.vim src/version.c |
diffstat | 3 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cindent.c +++ b/src/cindent.c @@ -755,6 +755,10 @@ cin_is_cpp_namespace(char_u *s) int has_name_start = FALSE; s = cin_skipcomment(s); + + if (STRNCMP(s, "inline", 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]))) { p = cin_skipcomment(skipwhite(s + 9));
--- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -996,6 +996,15 @@ func Test_cindent_1() 22222222222222222; } } + inline namespace { + 111111111111111111; + } + inline /* test */ namespace { + 111111111111111111; + } + inline/* test */namespace { + 111111111111111111; + } /* invalid namespaces use block indent */ namespace test test2 { @@ -1019,6 +1028,9 @@ func Test_cindent_1() { 111111111111111111; } + inlinenamespace { + 111111111111111111; + } void getstring() { /* Raw strings */ @@ -1961,6 +1973,15 @@ func Test_cindent_1() 22222222222222222; } } + inline namespace { + 111111111111111111; + } + inline /* test */ namespace { + 111111111111111111; + } + inline/* test */namespace { + 111111111111111111; + } /* invalid namespaces use block indent */ namespace test test2 { @@ -1984,6 +2005,9 @@ func Test_cindent_1() { 111111111111111111; } + inlinenamespace { + 111111111111111111; + } void getstring() { /* Raw strings */ @@ -4358,6 +4382,15 @@ func Test_cindent_47() 22222222222222222; } } + inline namespace { + 111111111111111111; + } + inline /* test */ namespace { + 111111111111111111; + } + inline/* test */namespace { + 111111111111111111; + } /* invalid namespaces use block indent */ namespace test test2 { @@ -4381,6 +4414,9 @@ func Test_cindent_47() { 111111111111111111; } + inlinenamespace { + 111111111111111111; + } NAMESPACEEND [CODE] @@ -4449,6 +4485,15 @@ func Test_cindent_47() 22222222222222222; } } + inline namespace { + 111111111111111111; + } + inline /* test */ namespace { + 111111111111111111; + } + inline/* test */namespace { + 111111111111111111; + } /* invalid namespaces use block indent */ namespace test test2 { @@ -4472,6 +4517,9 @@ func Test_cindent_47() { 111111111111111111; } + inlinenamespace { + 111111111111111111; + } NAMESPACEEND [CODE]