diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2022-08-23 06:00:53 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2022-11-17 12:37:09 (GMT) |
commit | 84241189f6a68611f79e9a3d78fc0192e1008cb1 (patch) | |
tree | 232a7d575ee388463ead7fb2d27078bde2da9036 /Source/cmDocumentationFormatter.cxx | |
parent | bbe854a45af977481772f50873e72ac9ba53805c (diff) | |
download | CMake-84241189f6a68611f79e9a3d78fc0192e1008cb1.zip CMake-84241189f6a68611f79e9a3d78fc0192e1008cb1.tar.gz CMake-84241189f6a68611f79e9a3d78fc0192e1008cb1.tar.bz2 |
cmDocumentationFormatter: Prevent indentation reset side effect
Fix `cmDocumentationFormatter::PrintColumn()` method to eliminate
an indentation reset side effect.
Diffstat (limited to 'Source/cmDocumentationFormatter.cxx')
-rw-r--r-- | Source/cmDocumentationFormatter.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index e2c521d..8f0976c 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -153,8 +153,6 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text) void cmDocumentationFormatter::PrintSection( std::ostream& os, cmDocumentationSection const& section) { - os << section.GetName() << '\n'; - const std::size_t PREFIX_SIZE = sizeof(cmDocumentationEntry::CustomNamePrefix) + 1u; // length of the "= " literal (see below) @@ -165,6 +163,10 @@ void cmDocumentationFormatter::PrintSection( const std::size_t PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE; const std::size_t TITLE_SIZE = NAME_SIZE + PADDING_SIZE; + const auto savedIndent = this->TextIndent; + + os << section.GetName() << '\n'; + for (cmDocumentationEntry const& entry : section.GetEntries()) { if (!entry.Name.empty()) { this->TextIndent = TITLE_SIZE; @@ -183,5 +185,8 @@ void cmDocumentationFormatter::PrintSection( this->PrintFormatted(os, entry.Brief.c_str()); } } + os << '\n'; + + this->TextIndent = savedIndent; } |