From b0d1be6c9548474e142d62a2f1e5b0fc7b7e3f5e Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Tue, 27 Aug 2024 15:01:29 +0200 Subject: [PATCH] Do not print unnecessary whitespace --- source/base/parameter_handler.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 189910f9fe..174d9a866b 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1506,15 +1506,23 @@ ParameterHandler::recursively_print_parameters( 78 - overall_indent_level * 2 - 2); for (const auto &doc_line : doc_lines) - out << std::setw(overall_indent_level * 2) << "" - << "# " << doc_line << '\n'; + { + out << std::setw(overall_indent_level * 2) << '#'; + + if (!doc_line.empty()) + out << ' ' << doc_line; + + out << '\n'; + } } - // print name and value of this entry - out << std::setw(overall_indent_level * 2) << "" - << "set " << demangle(p.first) - << std::setw(longest_name - demangle(p.first).size() + 1) << " " - << "= " << value; + // print the name and (if set) value of this entry + out << std::setw(overall_indent_level * 2) << "set " + << demangle(p.first) + << std::setw(longest_name - demangle(p.first).size() + 1) << ' ' + << '='; + if (!value.empty()) + out << ' ' << value; // finally print the default value, but only if it differs // from the actual value -- 2.39.5