mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-1547
- TW-1547 Recur column is always shown even if no recurring task is displayed (thanks to Renato Alves).
This commit is contained in:
parent
d2b2631db7
commit
f2998aba74
10 changed files with 209 additions and 158 deletions
|
@ -1,7 +1,11 @@
|
||||||
2.4.2 () -
|
2.4.2 () -
|
||||||
|
|
||||||
- TW-1546 column type due.remaining breaks colors on due tasks (thanks to Renato
|
- TW-1547 Recur column is always shown even if no recurring task is displayed
|
||||||
Alves).
|
(thanks to Renato Alves).
|
||||||
|
- TW-1545 cc1plus: error: unrecognized command line option '-std=c++11' (thanks
|
||||||
|
to Petteri).
|
||||||
|
- TW-1546 column type due.remaining breaks colors on due tasks (thanks to
|
||||||
|
Renato Alves).
|
||||||
- Eliminated some code that is not UTF8-safe.
|
- Eliminated some code that is not UTF8-safe.
|
||||||
- Removed pthreads linkage.
|
- Removed pthreads linkage.
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@ bool ColumnIMask::validate (std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
minimum = maximum = task.get ("imask").length ();
|
minimum = maximum = task.get ("imask").length ();
|
||||||
|
|
||||||
|
@ -68,6 +72,7 @@ void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
||||||
_style != "number")
|
_style != "number")
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnIMask::render (
|
void ColumnIMask::render (
|
||||||
|
@ -76,6 +81,7 @@ void ColumnIMask::render (
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
{
|
{
|
||||||
|
if (task.has (_name))
|
||||||
lines.push_back (color.colorize (rightJustify (task.get ("imask"), width)));
|
lines.push_back (color.colorize (rightJustify (task.get ("imask"), width)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,12 +61,16 @@ bool ColumnMask::validate (std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
minimum = maximum = task.get ("mask").length ();
|
minimum = maximum = task.get ("mask").length ();
|
||||||
|
|
||||||
if (_style != "default")
|
if (_style != "default")
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnMask::render (
|
void ColumnMask::render (
|
||||||
|
@ -75,6 +79,7 @@ void ColumnMask::render (
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
{
|
{
|
||||||
|
if (task.has (_name))
|
||||||
lines.push_back (color.colorize (task.get ("mask")));
|
lines.push_back (color.colorize (task.get ("mask")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,13 +62,18 @@ bool ColumnParent::validate (std::string& value)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the 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)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||||
else if (_style == "short") minimum = maximum = 8;
|
else if (_style == "short") minimum = maximum = 8;
|
||||||
else
|
else
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnParent::render (
|
void ColumnParent::render (
|
||||||
|
@ -76,6 +81,8 @@ void ColumnParent::render (
|
||||||
Task& task,
|
Task& task,
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
|
{
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
||||||
// 34f00694 short
|
// 34f00694 short
|
||||||
|
@ -93,5 +100,6 @@ void ColumnParent::render (
|
||||||
lines.push_back (color.colorize (leftJustify ("", width)));
|
lines.push_back (color.colorize (leftJustify ("", width)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -77,6 +77,9 @@ void ColumnPriority::setStyle (const std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
std::string priority = task.get (_name);
|
std::string priority = task.get (_name);
|
||||||
|
|
||||||
|
@ -95,6 +98,7 @@ void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& m
|
||||||
_style != "short")
|
_style != "short")
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnPriority::render (
|
void ColumnPriority::render (
|
||||||
|
@ -102,6 +106,8 @@ void ColumnPriority::render (
|
||||||
Task& task,
|
Task& task,
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
|
{
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
std::string priority = task.get (_name);
|
std::string priority = task.get (_name);
|
||||||
if (_style == "long")
|
if (_style == "long")
|
||||||
|
@ -113,6 +119,7 @@ void ColumnPriority::render (
|
||||||
|
|
||||||
lines.push_back (color.colorize (leftJustify (priority, width)));
|
lines.push_back (color.colorize (leftJustify (priority, width)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string ColumnPriority::modify (std::string& value)
|
std::string ColumnPriority::modify (std::string& value)
|
||||||
|
|
|
@ -67,6 +67,10 @@ bool ColumnProject::validate (std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
std::string project = task.get (_name);
|
std::string project = task.get (_name);
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
||||||
minimum = longestWord (project);
|
minimum = longestWord (project);
|
||||||
maximum = utf8_width (project);
|
maximum = utf8_width (project);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnProject::render (
|
void ColumnProject::render (
|
||||||
|
@ -95,6 +100,8 @@ void ColumnProject::render (
|
||||||
Task& task,
|
Task& task,
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
|
{
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
std::string project = task.get (_name);
|
std::string project = task.get (_name);
|
||||||
if (_style == "parent")
|
if (_style == "parent")
|
||||||
|
@ -115,5 +122,6 @@ void ColumnProject::render (
|
||||||
for (i = raw.begin (); i != raw.end (); ++i)
|
for (i = raw.begin (); i != raw.end (); ++i)
|
||||||
lines.push_back (color.colorize (leftJustify (*i, width)));
|
lines.push_back (color.colorize (leftJustify (*i, width)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -78,6 +78,10 @@ void ColumnRecur::setStyle (const std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
if (_style == "default" ||
|
if (_style == "default" ||
|
||||||
_style == "duration")
|
_style == "duration")
|
||||||
|
@ -92,6 +96,7 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
||||||
else
|
else
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnRecur::render (
|
void ColumnRecur::render (
|
||||||
|
@ -108,8 +113,7 @@ void ColumnRecur::render (
|
||||||
lines.push_back (
|
lines.push_back (
|
||||||
color.colorize (
|
color.colorize (
|
||||||
rightJustify (
|
rightJustify (
|
||||||
Duration (task.get ("recur")).formatISO (),
|
Duration (task.get ("recur")).formatISO (), width)));
|
||||||
width)));
|
|
||||||
}
|
}
|
||||||
else if (_style == "indicator")
|
else if (_style == "indicator")
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,6 +71,8 @@ void ColumnString::setReport (const std::string& value)
|
||||||
//
|
//
|
||||||
void ColumnString::measure (const std::string& value, unsigned int& minimum, unsigned int& maximum)
|
void ColumnString::measure (const std::string& value, unsigned int& minimum, unsigned int& maximum)
|
||||||
{
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
if (_style == "left" ||
|
if (_style == "left" ||
|
||||||
_style == "right" ||
|
_style == "right" ||
|
||||||
_style == "default")
|
_style == "default")
|
||||||
|
|
|
@ -83,6 +83,10 @@ void ColumnTags::setStyle (const std::string& value)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set the minimum and maximum widths for the value.
|
// Set the minimum and maximum widths for the value.
|
||||||
void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
{
|
||||||
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
if (_style == "indicator") minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
|
if (_style == "indicator") minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
|
||||||
else if (_style == "count") minimum = maximum = 3;
|
else if (_style == "count") minimum = maximum = 3;
|
||||||
|
@ -90,7 +94,6 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
||||||
_style == "list")
|
_style == "list")
|
||||||
{
|
{
|
||||||
std::string tags = task.get (_name);
|
std::string tags = task.get (_name);
|
||||||
minimum = 0;
|
|
||||||
maximum = utf8_width (tags);
|
maximum = utf8_width (tags);
|
||||||
|
|
||||||
if (maximum)
|
if (maximum)
|
||||||
|
@ -109,6 +112,7 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
||||||
else
|
else
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnTags::render (
|
void ColumnTags::render (
|
||||||
|
@ -117,9 +121,9 @@ void ColumnTags::render (
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
{
|
{
|
||||||
std::string tags = task.get (_name);
|
if (task.has (_name))
|
||||||
if (tags != "")
|
|
||||||
{
|
{
|
||||||
|
std::string tags = task.get (_name);
|
||||||
if (_style == "default" ||
|
if (_style == "default" ||
|
||||||
_style == "list")
|
_style == "list")
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,8 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
||||||
{
|
{
|
||||||
minimum = maximum = 0;
|
minimum = maximum = 0;
|
||||||
|
|
||||||
|
if (task.has (_name))
|
||||||
|
{
|
||||||
if (_style == "default")
|
if (_style == "default")
|
||||||
{
|
{
|
||||||
std::string value = task.get (_name);
|
std::string value = task.get (_name);
|
||||||
|
@ -124,6 +126,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
||||||
else
|
else
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ColumnUDA::render (
|
void ColumnUDA::render (
|
||||||
|
@ -131,12 +134,12 @@ void ColumnUDA::render (
|
||||||
Task& task,
|
Task& task,
|
||||||
int width,
|
int width,
|
||||||
Color& color)
|
Color& color)
|
||||||
|
{
|
||||||
|
if (task.has (_name))
|
||||||
{
|
{
|
||||||
if (_style == "default")
|
if (_style == "default")
|
||||||
{
|
{
|
||||||
std::string value = task.get (_name);
|
std::string value = task.get (_name);
|
||||||
if (value != "")
|
|
||||||
{
|
|
||||||
if (_type == "date")
|
if (_type == "date")
|
||||||
{
|
{
|
||||||
// Determine the output date format, which uses a hierarchy of definitions.
|
// Determine the output date format, which uses a hierarchy of definitions.
|
||||||
|
@ -177,7 +180,6 @@ void ColumnUDA::render (
|
||||||
lines.push_back (color.colorize (rightJustify (value, width)));
|
lines.push_back (color.colorize (rightJustify (value, width)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (_style == "indicator")
|
else if (_style == "indicator")
|
||||||
{
|
{
|
||||||
if (task.has (_name))
|
if (task.has (_name))
|
||||||
|
@ -186,5 +188,6 @@ void ColumnUDA::render (
|
||||||
rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
|
rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue