- TW-1547 Recur column is always shown even if no recurring task is displayed
          (thanks to Renato Alves).
This commit is contained in:
Paul Beckingham
2015-02-18 20:53:56 -08:00
parent d2b2631db7
commit f2998aba74
10 changed files with 209 additions and 158 deletions

View File

@@ -62,12 +62,17 @@ bool ColumnParent::validate (std::string& value)
////////////////////////////////////////////////////////////////////////////////
// Set the minimum and maximum widths for the value.
void ColumnParent::measure (Task&, unsigned int& minimum, unsigned int& maximum)
void ColumnParent::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
{
if (_style == "default" || _style == "long") minimum = maximum = 36;
else if (_style == "short") minimum = maximum = 8;
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
minimum = maximum = 0;
if (task.has (_name))
{
if (_style == "default" || _style == "long") minimum = maximum = 36;
else if (_style == "short") minimum = maximum = 8;
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -77,20 +82,23 @@ void ColumnParent::render (
int width,
Color& color)
{
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
// 34f00694 short
if (_style == "default" ||
_style == "long")
if (task.has (_name))
{
lines.push_back (color.colorize (leftJustify (task.get (_name), width)));
}
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
// 34f00694 short
if (_style == "default" ||
_style == "long")
{
lines.push_back (color.colorize (leftJustify (task.get (_name), width)));
}
else if (_style == "short")
{
if (task.has (_name))
lines.push_back (color.colorize (leftJustify (task.get (_name).substr (28), width)));
else
lines.push_back (color.colorize (leftJustify ("", width)));
else if (_style == "short")
{
if (task.has (_name))
lines.push_back (color.colorize (leftJustify (task.get (_name).substr (28), width)));
else
lines.push_back (color.colorize (leftJustify ("", width)));
}
}
}