diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index 6fb535ce5..f1d15eb0d 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -163,7 +163,8 @@ std::string ViewTask::render (std::vector & data, std::vector & seque if (_width == 0 || sum_ideal <= overage) widths = ideal; else if (sum_minimal > overage) - throw std::string ("There is not enough horizontal width to display the results."); +// throw std::string ("There is not enough horizontal width to display the results."); + widths = minimal; else { widths = minimal; @@ -221,7 +222,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque if (c) out += intra; - if (headers[i].size () < max_lines - i) + if (headers[c].size () < max_lines - i) out += _header.colorize (std::string (widths[c], ' ')); else out += headers[c][i]; diff --git a/src/ViewText.cpp b/src/ViewText.cpp index a920046e3..a805ebda7 100644 --- a/src/ViewText.cpp +++ b/src/ViewText.cpp @@ -68,7 +68,7 @@ void ViewText::set (int row, int col, const std::string& value, Color color) _data[row][col] = value; if (color.nontrivial () && - ! context.color ()) + context.color ()) _color[row][col] = color; } @@ -79,7 +79,7 @@ void ViewText::set (int row, int col, int value, Color color) _data[row][col] = string_value; if (color.nontrivial () && - ! context.color ()) + context.color ()) _color[row][col] = color; } @@ -90,7 +90,15 @@ void ViewText::set (int row, int col, float value, int width, int precision, Col _data[row][col] = string_value; if (color.nontrivial () && - ! context.color ()) + context.color ()) + _color[row][col] = color; +} + +//////////////////////////////////////////////////////////////////////////////// +void ViewText::set (int row, int col, Color color) +{ + if (color.nontrivial () && + context.color ()) _color[row][col] = color; } @@ -144,7 +152,8 @@ std::string ViewText::render () if (sum_ideal <= overage) widths = ideal; else if (sum_minimal > overage) - throw std::string ("There is not enough horizontal width to display the results."); +// throw std::string ("There is not enough horizontal width to display the results."); + widths = minimal; else { widths = minimal; @@ -199,7 +208,7 @@ std::string ViewText::render () if (c) out += intra; - if (headers[i].size () < max_lines - i) + if (headers[c].size () < max_lines - i) out += _header.colorize (std::string (widths[c], ' ')); else out += headers[c][i]; diff --git a/src/ViewText.h b/src/ViewText.h index 6626bd6af..a3d9675d7 100644 --- a/src/ViewText.h +++ b/src/ViewText.h @@ -62,6 +62,7 @@ public: void set (int, int, const std::string&, Color color = Color::nocolor); void set (int, int, int, Color color = Color::nocolor); void set (int, int, float, int, int, Color color = Color::nocolor); + void set (int, int, Color); // View rendering. std::string render (); diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index a199f0873..e1c87c9a2 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -148,7 +148,7 @@ void Column::renderHeader ( Color& color) { if (context.verbose ("label") && - _label != "") + nontrivial (_label)) { // Create a basic label. std::string header; diff --git a/src/report.cpp b/src/report.cpp index 075dd902f..5f76dea36 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -928,25 +928,25 @@ std::string renderMonths ( { if (weekStart == 1) { - view.add (Column::factory ("string", " ")); - view.add (Column::factory ("string", "Mo")); - view.add (Column::factory ("string", "Tu")); - view.add (Column::factory ("string", "We")); - view.add (Column::factory ("string", "Th")); - view.add (Column::factory ("string", "Fr")); - view.add (Column::factory ("string", "Sa")); - view.add (Column::factory ("string", "Su")); + view.add (Column::factory ("string.right", " ")); + view.add (Column::factory ("string.right", "Mo")); + view.add (Column::factory ("string.right", "Tu")); + view.add (Column::factory ("string.right", "We")); + view.add (Column::factory ("string.right", "Th")); + view.add (Column::factory ("string.right", "Fr")); + view.add (Column::factory ("string.right", "Sa")); + view.add (Column::factory ("string.right", "Su")); } else { - view.add (Column::factory ("string", " ")); - view.add (Column::factory ("string", "Su")); - view.add (Column::factory ("string", "Mo")); - view.add (Column::factory ("string", "Tu")); - view.add (Column::factory ("string", "We")); - view.add (Column::factory ("string", "Th")); - view.add (Column::factory ("string", "Fr")); - view.add (Column::factory ("string", "Sa")); + view.add (Column::factory ("string.right", " ")); + view.add (Column::factory ("string.right", "Su")); + view.add (Column::factory ("string.right", "Mo")); + view.add (Column::factory ("string.right", "Tu")); + view.add (Column::factory ("string.right", "We")); + view.add (Column::factory ("string.right", "Th")); + view.add (Column::factory ("string.right", "Fr")); + view.add (Column::factory ("string.right", "Sa")); } } @@ -1087,8 +1087,8 @@ std::string renderMonths ( } } } -// TODO Solve this. -// table.setCellColor (row, thisCol, cellColor); + + view.set (row, thisCol, cellColor); } // Check for end of week, and...