mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
cmDocumentationFormatter: Prevent indentation reset side effect
Fix `cmDocumentationFormatter::PrintColumn()` method to eliminate an indentation reset side effect.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user