]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix an issue with spaces in ParameterHandler output.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 23 Jan 2025 17:25:13 +0000 (10:25 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 27 Jan 2025 18:06:50 +0000 (11:06 -0700)
source/base/parameter_handler.cc

index f34fa405d4f27bdd067a4f7733e054b1decd813a..955318c17e6e88ffc30ea7202459a4e70fe9f3a7 100644 (file)
@@ -1592,7 +1592,9 @@ ParameterHandler::recursively_print_parameters(
 
                 for (const auto &doc_line : doc_lines)
                   {
-                    out << std::setw(overall_indent_level * 2) << '#';
+                    // Start with the comment start ('#'), padded with
+                    // overall_indent_level*2 spaces at the front.
+                    out << std::setw(overall_indent_level * 2) << "" << '#';
 
                     if (!doc_line.empty())
                       out << ' ' << doc_line;
@@ -1601,9 +1603,10 @@ ParameterHandler::recursively_print_parameters(
                   }
               }
 
-            // print the name and (if set) value of this entry
-            out << std::setw(overall_indent_level * 2) << "set "
-                << demangle(p.first)
+            // Print the name and (if set) value of this entry. Ensure proper
+            // padding with overall_indent_level*2 spaces at the front.
+            out << std::setw(overall_indent_level * 2) << ""
+                << "set " << demangle(p.first)
                 << std::setw(longest_name - demangle(p.first).size() + 1) << ' '
                 << '=';
             if (!value.empty())

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.