diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index 31164f768..b87add4df 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -162,10 +162,10 @@ std::string ViewTask::render (std::vector & data, std::vector & seque std::vector widths; if (_width == 0 || sum_ideal <= overage) widths = ideal; - else if (sum_minimal > overage) + else if (sum_minimal > overage || overage < 0) // throw std::string ("There is not enough horizontal width to display the results."); widths = minimal; - else + else if (overage > 0) { widths = minimal; overage -= sum_minimal; diff --git a/src/ViewText.cpp b/src/ViewText.cpp index ea588fa80..287942b3b 100644 --- a/src/ViewText.cpp +++ b/src/ViewText.cpp @@ -151,10 +151,10 @@ std::string ViewText::render () std::vector widths; if (sum_ideal <= overage) widths = ideal; - else if (sum_minimal > overage) + else if (sum_minimal > overage || overage < 0) // throw std::string ("There is not enough horizontal width to display the results."); widths = minimal; - else + else if (overage > 0) { widths = minimal; overage -= sum_minimal; diff --git a/src/text.cpp b/src/text.cpp index b2f4e9e81..6041a3fab 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -57,9 +57,11 @@ void wrapText ( std::string copy = text; std::string line; + int modified_width = width > 0 ? width : 1; + while (copy.length ()) // Used as Boolean, therefore UTF8 safe. { - extractLine (copy, line, width); + extractLine (copy, line, modified_width); lines.push_back (line); } }