mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
ViewTask
- When supplied with a vector of attribute names, can insert spacing into the rendered output when values change. These we call listing breaks.
This commit is contained in:
parent
32566c9844
commit
9c2aea6d62
2 changed files with 53 additions and 32 deletions
|
@ -307,6 +307,25 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
max_lines = cells[c].size ();
|
||||
}
|
||||
|
||||
// Listing breaks are simply blank lines inserted when a column value
|
||||
// changes.
|
||||
if (s > 0 &&
|
||||
_breaks.size () > 0)
|
||||
{
|
||||
std::vector <std::string>::iterator b;
|
||||
for (b = _breaks.begin (); b != _breaks.end (); ++b)
|
||||
{
|
||||
if (data[sequence[s - 1]].get (*b) != data[sequence[s]].get (*b))
|
||||
{
|
||||
out += "\n";
|
||||
++_lines;
|
||||
|
||||
// Only want one \n, regardless of how many values change.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < max_lines; ++i)
|
||||
{
|
||||
out += left_margin + (odd ? extra_odd : extra_even);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue