mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Fixed bug whereby table headers were underlined when color is turned off.
This commit is contained in:
parent
2d21558a5a
commit
5d158d752d
3 changed files with 197 additions and 134 deletions
|
@ -15,6 +15,8 @@ represents a feature release, and the Z represents a patch.
|
|||
+ "task undelete" can now undelete erroneously deleted tasks, provided no
|
||||
reports have been run (and therefore TDB::gc run)
|
||||
+ Added averages to the "task history" report
|
||||
+ Bug: Fixed where Esc[0m sequences were being emitted for no good reason
|
||||
+ Bug: Fixed underlined table headers when color is turned off
|
||||
|
||||
------ reality -----------------------------------
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
<li>Added "task undelete" feature to restore a (very) recently deleted
|
||||
task
|
||||
<li>Added averages to the "task history" report
|
||||
<li>Fixed bug where Esc[0m sequences were being emitted for no good reason
|
||||
<li>Fixed bug where table headers are underlined when color is turned off
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
59
src/task.cpp
59
src/task.cpp
|
@ -407,8 +407,11 @@ void handleProjects (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Project");
|
||||
table.addColumn ("Tasks");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
}
|
||||
|
||||
table.setColumnJustification (1, Table::right);
|
||||
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
|
||||
|
@ -505,6 +508,8 @@ void handleList (const TDB& tdb, T& task, Config& conf)
|
|||
if (showAge) table.addColumn ("Age");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
|
@ -512,6 +517,7 @@ void handleList (const TDB& tdb, T& task, Config& conf)
|
|||
table.setColumnUnderline (4);
|
||||
table.setColumnUnderline (5);
|
||||
if (showAge) table.setColumnUnderline (6);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -637,10 +643,13 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Pri");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
table.setColumnUnderline (3);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -755,9 +764,12 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Project");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -833,8 +845,11 @@ void handleInfo (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Name");
|
||||
table.addColumn ("Value");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -1049,6 +1064,8 @@ void handleLongList (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Tags");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
|
@ -1058,6 +1075,7 @@ void handleLongList (const TDB& tdb, T& task, Config& conf)
|
|||
table.setColumnUnderline (6);
|
||||
table.setColumnUnderline (7);
|
||||
if (showAge) table.setColumnUnderline (8);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -1246,10 +1264,13 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Complete");
|
||||
table.addColumn ("0% 100%");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
table.setColumnUnderline (3);
|
||||
}
|
||||
|
||||
table.setColumnJustification (1, Table::right);
|
||||
table.setColumnJustification (2, Table::right);
|
||||
|
@ -1379,6 +1400,8 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf)
|
|||
if (showAge) table.addColumn ("Age");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
|
@ -1386,6 +1409,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf)
|
|||
table.setColumnUnderline (4);
|
||||
table.setColumnUnderline (5);
|
||||
if (showAge) table.setColumnUnderline (6);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -1588,12 +1612,15 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Deleted");
|
||||
table.addColumn ("Net");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
table.setColumnUnderline (3);
|
||||
table.setColumnUnderline (4);
|
||||
table.setColumnUnderline (5);
|
||||
}
|
||||
|
||||
table.setColumnJustification (2, Table::right);
|
||||
table.setColumnJustification (3, Table::right);
|
||||
|
@ -1714,8 +1741,13 @@ void handleReportUsage (const TDB& tdb, T& task, Config& conf)
|
|||
Table table;
|
||||
table.addColumn ("Command");
|
||||
table.addColumn ("Frequency");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
}
|
||||
|
||||
table.setColumnJustification (1, Table::right);
|
||||
table.sortOn (1, Table::descendingNumeric);
|
||||
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
|
||||
|
@ -1763,6 +1795,8 @@ std::string renderMonths (
|
|||
table.addColumn ("Fr");
|
||||
table.addColumn ("Sa");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (i + 1);
|
||||
table.setColumnUnderline (i + 2);
|
||||
table.setColumnUnderline (i + 3);
|
||||
|
@ -1770,6 +1804,7 @@ std::string renderMonths (
|
|||
table.setColumnUnderline (i + 5);
|
||||
table.setColumnUnderline (i + 6);
|
||||
table.setColumnUnderline (i + 7);
|
||||
}
|
||||
|
||||
table.setColumnJustification (i + 0, Table::right);
|
||||
table.setColumnJustification (i + 1, Table::right);
|
||||
|
@ -1971,11 +2006,14 @@ void handleReportActive (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Due");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
table.setColumnUnderline (3);
|
||||
table.setColumnUnderline (4);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -2079,11 +2117,14 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf)
|
|||
table.addColumn ("Due");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
table.setColumnUnderline (3);
|
||||
table.setColumnUnderline (4);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -2189,6 +2230,8 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf)
|
|||
if (showAge) table.addColumn ("Age");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
|
@ -2196,6 +2239,7 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf)
|
|||
table.setColumnUnderline (4);
|
||||
table.setColumnUnderline (5);
|
||||
if (showAge) table.setColumnUnderline (6);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -2325,6 +2369,8 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf)
|
|||
if (showAge) table.addColumn ("Age");
|
||||
table.addColumn ("Description");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
table.setColumnUnderline (2);
|
||||
|
@ -2332,6 +2378,7 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf)
|
|||
table.setColumnUnderline (4);
|
||||
table.setColumnUnderline (5);
|
||||
if (showAge) table.setColumnUnderline (6);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::minimum);
|
||||
|
@ -2526,8 +2573,13 @@ void handleVersion (Config& conf)
|
|||
table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
|
||||
table.addColumn ("Config variable");
|
||||
table.addColumn ("Value");
|
||||
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
table.setColumnUnderline (0);
|
||||
table.setColumnUnderline (1);
|
||||
}
|
||||
|
||||
table.setColumnWidth (0, Table::minimum);
|
||||
table.setColumnWidth (1, Table::flexible);
|
||||
table.setColumnJustification (0, Table::left);
|
||||
|
@ -2770,6 +2822,8 @@ void handleModify (const TDB& tdb, T& task, Config& conf)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void handleColor (Config& conf)
|
||||
{
|
||||
if (conf.get ("color", true))
|
||||
{
|
||||
std::cout << optionalBlankLine (conf) << "Foreground" << std::endl
|
||||
<< " "
|
||||
|
@ -2844,6 +2898,11 @@ void handleColor (Config& conf)
|
|||
|
||||
<< optionalBlankLine (conf);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Color is currently turned off in your .taskrc file." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void gatherNextTasks (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue