- Fixed bug whereby table headers were underlined when color is turned off.

This commit is contained in:
Paul Beckingham
2008-06-24 01:37:18 -04:00
parent 2d21558a5a
commit 5d158d752d
3 changed files with 197 additions and 134 deletions

View File

@@ -15,6 +15,8 @@ represents a feature release, and the Z represents a patch.
+ "task undelete" can now undelete erroneously deleted tasks, provided no + "task undelete" can now undelete erroneously deleted tasks, provided no
reports have been run (and therefore TDB::gc run) reports have been run (and therefore TDB::gc run)
+ Added averages to the "task history" report + 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 ----------------------------------- ------ reality -----------------------------------

View File

@@ -51,6 +51,8 @@
<li>Added "task undelete" feature to restore a (very) recently deleted <li>Added "task undelete" feature to restore a (very) recently deleted
task task
<li>Added averages to the "task history" report <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> </ul>
<p> <p>

View File

@@ -407,8 +407,11 @@ void handleProjects (const TDB& tdb, T& task, Config& conf)
table.addColumn ("Project"); table.addColumn ("Project");
table.addColumn ("Tasks"); table.addColumn ("Tasks");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
}
table.setColumnJustification (1, Table::right); table.setColumnJustification (1, Table::right);
table.setDateFormat (conf.get ("dateformat", "m/d/Y")); 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"); if (showAge) table.addColumn ("Age");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
@@ -512,6 +517,7 @@ void handleList (const TDB& tdb, T& task, Config& conf)
table.setColumnUnderline (4); table.setColumnUnderline (4);
table.setColumnUnderline (5); table.setColumnUnderline (5);
if (showAge) table.setColumnUnderline (6); if (showAge) table.setColumnUnderline (6);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Pri");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
table.setColumnUnderline (3); table.setColumnUnderline (3);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Project");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Name");
table.addColumn ("Value"); table.addColumn ("Value");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Tags");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
@@ -1058,6 +1075,7 @@ void handleLongList (const TDB& tdb, T& task, Config& conf)
table.setColumnUnderline (6); table.setColumnUnderline (6);
table.setColumnUnderline (7); table.setColumnUnderline (7);
if (showAge) table.setColumnUnderline (8); if (showAge) table.setColumnUnderline (8);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Complete");
table.addColumn ("0% 100%"); table.addColumn ("0% 100%");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
table.setColumnUnderline (3); table.setColumnUnderline (3);
}
table.setColumnJustification (1, Table::right); table.setColumnJustification (1, Table::right);
table.setColumnJustification (2, 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"); if (showAge) table.addColumn ("Age");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
@@ -1386,6 +1409,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf)
table.setColumnUnderline (4); table.setColumnUnderline (4);
table.setColumnUnderline (5); table.setColumnUnderline (5);
if (showAge) table.setColumnUnderline (6); if (showAge) table.setColumnUnderline (6);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Deleted");
table.addColumn ("Net"); table.addColumn ("Net");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
table.setColumnUnderline (3); table.setColumnUnderline (3);
table.setColumnUnderline (4); table.setColumnUnderline (4);
table.setColumnUnderline (5); table.setColumnUnderline (5);
}
table.setColumnJustification (2, Table::right); table.setColumnJustification (2, Table::right);
table.setColumnJustification (3, Table::right); table.setColumnJustification (3, Table::right);
@@ -1714,8 +1741,13 @@ void handleReportUsage (const TDB& tdb, T& task, Config& conf)
Table table; Table table;
table.addColumn ("Command"); table.addColumn ("Command");
table.addColumn ("Frequency"); table.addColumn ("Frequency");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
}
table.setColumnJustification (1, Table::right); table.setColumnJustification (1, Table::right);
table.sortOn (1, Table::descendingNumeric); table.sortOn (1, Table::descendingNumeric);
table.setDateFormat (conf.get ("dateformat", "m/d/Y")); table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
@@ -1763,6 +1795,8 @@ std::string renderMonths (
table.addColumn ("Fr"); table.addColumn ("Fr");
table.addColumn ("Sa"); table.addColumn ("Sa");
if (conf.get ("color", true))
{
table.setColumnUnderline (i + 1); table.setColumnUnderline (i + 1);
table.setColumnUnderline (i + 2); table.setColumnUnderline (i + 2);
table.setColumnUnderline (i + 3); table.setColumnUnderline (i + 3);
@@ -1770,6 +1804,7 @@ std::string renderMonths (
table.setColumnUnderline (i + 5); table.setColumnUnderline (i + 5);
table.setColumnUnderline (i + 6); table.setColumnUnderline (i + 6);
table.setColumnUnderline (i + 7); table.setColumnUnderline (i + 7);
}
table.setColumnJustification (i + 0, Table::right); table.setColumnJustification (i + 0, Table::right);
table.setColumnJustification (i + 1, 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 ("Due");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
table.setColumnUnderline (3); table.setColumnUnderline (3);
table.setColumnUnderline (4); table.setColumnUnderline (4);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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 ("Due");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
table.setColumnUnderline (3); table.setColumnUnderline (3);
table.setColumnUnderline (4); table.setColumnUnderline (4);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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"); if (showAge) table.addColumn ("Age");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
@@ -2196,6 +2239,7 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf)
table.setColumnUnderline (4); table.setColumnUnderline (4);
table.setColumnUnderline (5); table.setColumnUnderline (5);
if (showAge) table.setColumnUnderline (6); if (showAge) table.setColumnUnderline (6);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, 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"); if (showAge) table.addColumn ("Age");
table.addColumn ("Description"); table.addColumn ("Description");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
table.setColumnUnderline (2); table.setColumnUnderline (2);
@@ -2332,6 +2378,7 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf)
table.setColumnUnderline (4); table.setColumnUnderline (4);
table.setColumnUnderline (5); table.setColumnUnderline (5);
if (showAge) table.setColumnUnderline (6); if (showAge) table.setColumnUnderline (6);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, Table::minimum); table.setColumnWidth (1, Table::minimum);
@@ -2526,8 +2573,13 @@ void handleVersion (Config& conf)
table.setDateFormat (conf.get ("dateformat", "m/d/Y")); table.setDateFormat (conf.get ("dateformat", "m/d/Y"));
table.addColumn ("Config variable"); table.addColumn ("Config variable");
table.addColumn ("Value"); table.addColumn ("Value");
if (conf.get ("color", true))
{
table.setColumnUnderline (0); table.setColumnUnderline (0);
table.setColumnUnderline (1); table.setColumnUnderline (1);
}
table.setColumnWidth (0, Table::minimum); table.setColumnWidth (0, Table::minimum);
table.setColumnWidth (1, Table::flexible); table.setColumnWidth (1, Table::flexible);
table.setColumnJustification (0, Table::left); table.setColumnJustification (0, Table::left);
@@ -2771,6 +2823,8 @@ void handleModify (const TDB& tdb, T& task, Config& conf)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void handleColor (Config& conf) void handleColor (Config& conf)
{ {
if (conf.get ("color", true))
{
std::cout << optionalBlankLine (conf) << "Foreground" << std::endl std::cout << optionalBlankLine (conf) << "Foreground" << std::endl
<< " " << " "
<< Text::colorize (Text::bold, Text::nocolor, "bold") << " " << Text::colorize (Text::bold, Text::nocolor, "bold") << " "
@@ -2843,6 +2897,11 @@ void handleColor (Config& conf)
<< Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl
<< optionalBlankLine (conf); << optionalBlankLine (conf);
}
else
{
std::cout << "Color is currently turned off in your .taskrc file." << std::endl;
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////