Columns: Removed _fixed_width for indicator columns

- Column indicator formats (depends.indicator, for example), should not set the
  ::_fixed_width flag because then the column does not have the opportunity to
  be suppressed via rc.print.empty.colums=1.
This commit is contained in:
Paul Beckingham 2015-07-11 22:09:15 -04:00
parent 31ff9d476e
commit e930bb0ba9
6 changed files with 29 additions and 19 deletions

View file

@ -83,8 +83,10 @@ void ColumnDepends::measure (Task& task, unsigned int& minimum, unsigned int& ma
if (_style == "indicator")
{
minimum = maximum = utf8_width (context.config.get ("dependency.indicator"));
_fixed_width = true;
if (task.has ("depends"))
minimum = maximum = utf8_width (context.config.get ("dependency.indicator"));
else
minimum = maximum = 0;
}
else if (_style == "count")
{

View file

@ -86,8 +86,10 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi
}
else if (_style == "indicator")
{
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
_fixed_width = true;
if (task.has ("recur"))
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
else
minimum = maximum = 0;
}
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);

View file

@ -74,8 +74,10 @@ void ColumnStart::measure (Task& task, unsigned int& minimum, unsigned int& maxi
{
if (_style == "active")
{
minimum = maximum = utf8_width (context.config.get ("active.indicator"));
_fixed_width = true;
if (task.has ("start"))
minimum = maximum = utf8_width (context.config.get ("active.indicator"));
else
minimum = maximum = 0;
}
else
ColumnDate::measure (task, minimum, maximum);

View file

@ -85,8 +85,10 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
{
if (_style == "indicator")
{
minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
_fixed_width = true;
if (task.has ("tags"))
minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
else
minimum = maximum = 0;
}
else if (_style == "count")
{

View file

@ -116,8 +116,10 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
}
else if (_style == "indicator")
{
minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator"));
_fixed_width = true;
if (task.has (_name))
minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator"));
else
minimum = maximum = 0;
}
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);

View file

@ -46,15 +46,15 @@ public:
bool operator== (const Column&) const; // TODO Is this necessary?
virtual ~Column ();
const std::string& name () const { return _name; }
const std::string& style () const { return _style; }
const std::string& label () const { return _label; }
const std::string& type () const { return _type; }
bool modifiable () const { return _modifiable; }
bool is_uda () const { return _uda; }
bool is_fixed_width () const { return _fixed_width;}
std::vector <std::string> styles () const { return _styles; }
std::vector <std::string> examples () const { return _examples; }
const std::string& name () const { return _name; }
const std::string& style () const { return _style; }
const std::string& label () const { return _label; }
const std::string& type () const { return _type; }
bool modifiable () const { return _modifiable; }
bool is_uda () const { return _uda; }
bool is_fixed_width () const { return _fixed_width; }
std::vector <std::string> styles () const { return _styles; }
std::vector <std::string> examples () const { return _examples; }
virtual void setStyle (const std::string& value) { _style = value; }
virtual void setLabel (const std::string& value) { _label = value; }