Use local variable for indent string

This commit is contained in:
Thomas Lauf 2018-11-16 16:33:20 +01:00
parent b00d097e3e
commit 37c7cc705d

View file

@ -129,15 +129,19 @@ int renderChart (
int last_hour = 23; int last_hour = 23;
determineHourRange (type, rules, filter, tracked, first_hour, last_hour); determineHourRange (type, rules, filter, tracked, first_hour, last_hour);
auto indent = std::string (getIndentSize (type, rules), ' ');
// Render the axis. // Render the axis.
std::cout << '\n'; std::cout << '\n';
if (rules.get ("reports." + type + ".axis") != "internal") if (rules.get ("reports." + type + ".axis") != "internal")
{
renderAxis (type, renderAxis (type,
rules, rules,
palette, palette,
std::string (getIndentSize (type, rules), ' '), indent,
first_hour, first_hour,
last_hour); last_hour);
}
// For rendering labels on edge detection. // For rendering labels on edge detection.
Datetime previous {0}; Datetime previous {0};
@ -147,7 +151,6 @@ int renderChart (
bool ids = findHint (cli, ":ids"); bool ids = findHint (cli, ":ids");
// Determine how much space is occupied by the left-margin labels. // Determine how much space is occupied by the left-margin labels.
auto indent = getIndentSize (type, rules);
auto cell = rules.getInteger ("reports." + type + ".cell"); auto cell = rules.getInteger ("reports." + type + ".cell");
if (cell < 1) if (cell < 1)
@ -201,7 +204,7 @@ int renderChart (
if (lines.size () > 1) if (lines.size () > 1)
for (unsigned int i = 1; i < lines.size (); ++i) for (unsigned int i = 1; i < lines.size (); ++i)
std::cout << "\n" std::cout << "\n"
<< std::string (indent, ' ') << indent
<< lines[i].str (); << lines[i].str ();
std::cout << renderTotal (type, rules, work) std::cout << renderTotal (type, rules, work)
@ -213,7 +216,7 @@ int renderChart (
std::cout << renderSubTotal (type, rules, first_hour, last_hour, total_work) std::cout << renderSubTotal (type, rules, first_hour, last_hour, total_work)
<< renderHolidays (type, rules, filter) << renderHolidays (type, rules, filter)
<< renderSummary (type, rules, std::string (indent, ' '), filter, exclusions, tracked, blank); << renderSummary (type, rules, indent, filter, exclusions, tracked, blank);
return 0; return 0;
} }