mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
View
- Modified layout algorithm to not attempt to distribute negative overage. - Modified wrapText to enforce a minimum wrap width of 1.
This commit is contained in:
parent
5d2528bff6
commit
69fc2c3be8
3 changed files with 7 additions and 5 deletions
|
@ -162,10 +162,10 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
||||||
std::vector <int> widths;
|
std::vector <int> widths;
|
||||||
if (_width == 0 || sum_ideal <= overage)
|
if (_width == 0 || sum_ideal <= overage)
|
||||||
widths = ideal;
|
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.");
|
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
else
|
else if (overage > 0)
|
||||||
{
|
{
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
overage -= sum_minimal;
|
overage -= sum_minimal;
|
||||||
|
|
|
@ -151,10 +151,10 @@ std::string ViewText::render ()
|
||||||
std::vector <int> widths;
|
std::vector <int> widths;
|
||||||
if (sum_ideal <= overage)
|
if (sum_ideal <= overage)
|
||||||
widths = ideal;
|
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.");
|
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
else
|
else if (overage > 0)
|
||||||
{
|
{
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
overage -= sum_minimal;
|
overage -= sum_minimal;
|
||||||
|
|
|
@ -57,9 +57,11 @@ void wrapText (
|
||||||
std::string copy = text;
|
std::string copy = text;
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
|
int modified_width = width > 0 ? width : 1;
|
||||||
|
|
||||||
while (copy.length ()) // Used as Boolean, therefore UTF8 safe.
|
while (copy.length ()) // Used as Boolean, therefore UTF8 safe.
|
||||||
{
|
{
|
||||||
extractLine (copy, line, width);
|
extractLine (copy, line, modified_width);
|
||||||
lines.push_back (line);
|
lines.push_back (line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue