- 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:
Paul Beckingham 2014-07-10 21:34:17 -04:00
parent 32566c9844
commit 9c2aea6d62
2 changed files with 53 additions and 32 deletions

View file

@ -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);