From 8e649a945650c42e87856c61aee6e98f86b610e8 Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Thu, 31 Jan 2019 16:55:42 +0100 Subject: [PATCH] Extract calculation of total_width from day-loop --- src/Chart.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Chart.cpp b/src/Chart.cpp index 14aec68a..6ef8ade3 100644 --- a/src/Chart.cpp +++ b/src/Chart.cpp @@ -83,8 +83,9 @@ std::string Chart::render ( const auto cell_size = chars_per_hour + spacing; const auto indent_size = getIndentSize (); + const auto total_width = (last_hour - first_hour + 1) * (cell_size) - 1; + const auto padding_size = indent_size + total_width + 2; const auto indent = std::string (indent_size, ' '); - const auto padding_size = indent_size + ((last_hour - first_hour + 1) * (cell_size)) + 1; std::stringstream out; @@ -115,7 +116,6 @@ std::string Chart::render ( // Add an empty string with no color, to reserve width, so this function // can simply concatenate to lines[i].str (). - int total_width = (last_hour - first_hour + 1) * (cell_size) - 1; std::vector lines (num_lines); for (int i = 0; i < num_lines; ++i) {