diff --git a/src/columns/ColString.cpp b/src/columns/ColString.cpp index d5421a904..e61f2fc39 100644 --- a/src/columns/ColString.cpp +++ b/src/columns/ColString.cpp @@ -25,7 +25,6 @@ // //////////////////////////////////////////////////////////////////////////////// -#include // TODO Remove #include #include #include @@ -58,13 +57,17 @@ void ColumnString::setReport (const std::string& value) // void ColumnString::measure (const std::string& value, int& minimum, int& maximum) { - std::string stripped = Color::strip (value); - maximum = stripped.length (); - if (_style == "left" || _style == "right" || _style == "default") + { + std::string stripped = Color::strip (value); + maximum = stripped.length (); minimum = longestWord (stripped); + } + else if (_style == "left_fixed" || + _style == "right_fixed") + minimum = maximum = strippedLength (value); else throw std::string ("Unrecognized column format 'string.") + _style + "'"; } @@ -94,6 +97,14 @@ void ColumnString::render ( for (i = raw.begin (); i != raw.end (); ++i) lines.push_back (color.colorize (rightJustify (*i, width))); } + else if (_style == "left_fixed") + { + lines.push_back (leftJustify (value, width)); + } + else if (_style == "right_fixed") + { + lines.push_back (rightJustify (value, width)); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/history.cpp b/src/history.cpp index 8c8595c9d..5889b96cb 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -26,7 +26,6 @@ //////////////////////////////////////////////////////////////////////////////// #include - #include #include #include @@ -551,13 +550,13 @@ int handleReportGHistoryAnnual (std::string& outs) } } - int widthOfBar = context.getWidth () - 5; // 5 == strlen ("2008 ") + int widthOfBar = context.getWidth () - 5; // 5 == strlen ("YYYY ") // Now build the view. ViewText view; view.width (context.getWidth ()); view.add (Column::factory ("string", "Year")); - view.add (Column::factory ("string", "Number Added/Completed/Deleted")); + view.add (Column::factory ("string.left_fixed", "Number Added/Completed/Deleted")); Color color_add (context.config.get ("color.history.add")); Color color_done (context.config.get ("color.history.done"));