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 () -
|
||||
|
||||
- TW-1546 column type due.remaining breaks colors on due tasks (thanks to Renato
|
||||
Alves).
|
||||
- TW-1547 Recur column is always shown even if no recurring task is displayed
|
||||
(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.
|
||||
- Removed pthreads linkage.
|
||||
|
||||
|
|
|
@ -61,6 +61,10 @@ bool ColumnIMask::validate (std::string& value)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_name))
|
||||
{
|
||||
minimum = maximum = task.get ("imask").length ();
|
||||
|
||||
|
@ -68,6 +72,7 @@ void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
|||
_style != "number")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnIMask::render (
|
||||
|
@ -76,6 +81,7 @@ void ColumnIMask::render (
|
|||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
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.
|
||||
void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
if (task.has (_name))
|
||||
{
|
||||
minimum = maximum = task.get ("mask").length ();
|
||||
|
||||
if (_style != "default")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnMask::render (
|
||||
|
@ -75,6 +79,7 @@ void ColumnMask::render (
|
|||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
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.
|
||||
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;
|
||||
else if (_style == "short") minimum = maximum = 8;
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnParent::render (
|
||||
|
@ -76,6 +81,8 @@ void ColumnParent::render (
|
|||
Task& task,
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
{
|
||||
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
||||
// 34f00694 short
|
||||
|
@ -93,5 +100,6 @@ void ColumnParent::render (
|
|||
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.
|
||||
void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string priority = task.get (_name);
|
||||
|
||||
|
@ -95,6 +98,7 @@ void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& m
|
|||
_style != "short")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnPriority::render (
|
||||
|
@ -102,6 +106,8 @@ void ColumnPriority::render (
|
|||
Task& task,
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string priority = task.get (_name);
|
||||
if (_style == "long")
|
||||
|
@ -113,6 +119,7 @@ void ColumnPriority::render (
|
|||
|
||||
lines.push_back (color.colorize (leftJustify (priority, width)));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
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.
|
||||
void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_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);
|
||||
maximum = utf8_width (project);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnProject::render (
|
||||
|
@ -95,6 +100,8 @@ void ColumnProject::render (
|
|||
Task& task,
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string project = task.get (_name);
|
||||
if (_style == "parent")
|
||||
|
@ -115,5 +122,6 @@ void ColumnProject::render (
|
|||
for (i = raw.begin (); i != raw.end (); ++i)
|
||||
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.
|
||||
void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "default" ||
|
||||
_style == "duration")
|
||||
|
@ -92,6 +96,7 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
|||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnRecur::render (
|
||||
|
@ -108,8 +113,7 @@ void ColumnRecur::render (
|
|||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
Duration (task.get ("recur")).formatISO (),
|
||||
width)));
|
||||
Duration (task.get ("recur")).formatISO (), width)));
|
||||
}
|
||||
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)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (_style == "left" ||
|
||||
_style == "right" ||
|
||||
_style == "default")
|
||||
|
|
|
@ -83,6 +83,10 @@ void ColumnTags::setStyle (const std::string& value)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the minimum and maximum widths for the value.
|
||||
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"));
|
||||
else if (_style == "count") minimum = maximum = 3;
|
||||
|
@ -90,7 +94,6 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
|||
_style == "list")
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
minimum = 0;
|
||||
maximum = utf8_width (tags);
|
||||
|
||||
if (maximum)
|
||||
|
@ -109,6 +112,7 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
|||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnTags::render (
|
||||
|
@ -117,9 +121,9 @@ void ColumnTags::render (
|
|||
int width,
|
||||
Color& color)
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
if (tags != "")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
if (_style == "default" ||
|
||||
_style == "list")
|
||||
{
|
||||
|
|
|
@ -80,6 +80,8 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
|||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "default")
|
||||
{
|
||||
std::string value = task.get (_name);
|
||||
|
@ -124,6 +126,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
|||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void ColumnUDA::render (
|
||||
|
@ -131,12 +134,12 @@ void ColumnUDA::render (
|
|||
Task& task,
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "default")
|
||||
{
|
||||
std::string value = task.get (_name);
|
||||
if (value != "")
|
||||
{
|
||||
if (_type == "date")
|
||||
{
|
||||
// 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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
|
@ -186,5 +188,6 @@ void ColumnUDA::render (
|
|||
rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue