From dbc98c1230c52db9b3de86e23c3dcadcf5dcf953 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 15 May 2009 21:02:06 -0400 Subject: [PATCH] Patch From a08f3f919f2f4b06503004ca764339918ee5d000 Mon Sep 17 00:00:00 2001 From: Johan Friis Date: Fri, 15 May 2009 16:14:26 +0100 Subject: [PATCH] fontunderline boolean config option Added an option to turn on/off the drawing of table headers with underlined font. If off, the default asciidashes will be used. It defaults to on. --- doc/man5/taskrc.5 | 5 +++++ html/config.html | 7 +++++++ src/report.cpp | 33 ++++++++++++++++++++++----------- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/doc/man5/taskrc.5 b/doc/man5/taskrc.5 index 18417485c..f1813359f 100644 --- a/doc/man5/taskrc.5 +++ b/doc/man5/taskrc.5 @@ -123,6 +123,11 @@ The width of tables used when ncurses support is not available. Defaults to 80. Determines whether task uses ncurses to establish the size of the window you are using, for text wrapping. +.TP +.B fontunderline=on +Determines if font underlines or ascii dashes should be used to underline +headers. + .TP .B due=7 This is the number of days into the future that define when a task is considered due, diff --git a/html/config.html b/html/config.html index 80a2c8a23..5cc6c010d 100644 --- a/html/config.html +++ b/html/config.html @@ -209,6 +209,13 @@ Defaults to 80. +
fontuderline
+
+ May be "on" or "off". Determines if font underlines or ascii + dashes should be used to underline headers. + Defaults to on. +
+
due
diff --git a/src/report.cpp b/src/report.cpp index 9e419bfac..050f6e85c 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -219,7 +219,8 @@ std::string handleCompleted (TDB& tdb, T& task, Config& conf) table.addColumn ("Project"); table.addColumn ("Description"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -329,7 +330,8 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf) table.addColumn ("Name"); table.addColumn ("Value"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -605,7 +607,8 @@ std::string handleReportSummary (TDB& tdb, T& task, Config& conf) table.addColumn ("Complete"); table.addColumn ("0% 100%"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -746,7 +749,8 @@ std::string handleReportNext (TDB& tdb, T& task, Config& conf) table.addColumn ("Age"); table.addColumn ("Description"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -988,7 +992,8 @@ std::string handleReportHistory (TDB& tdb, T& task, Config& conf) table.addColumn ("Deleted"); table.addColumn ("Net"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -1189,7 +1194,8 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf) table.addColumn ("Month"); table.addColumn ("Number Added/Completed/Deleted"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -1549,7 +1555,8 @@ std::string renderMonths ( table.addColumn ("Fr"); table.addColumn ("Sa"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (i + 1); table.setColumnUnderline (i + 2); @@ -1791,7 +1798,8 @@ std::string handleReportActive (TDB& tdb, T& task, Config& conf) table.addColumn ("Due"); table.addColumn ("Description"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -1924,7 +1932,8 @@ std::string handleReportOverdue (TDB& tdb, T& task, Config& conf) table.addColumn ("Due"); table.addColumn ("Description"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -2095,7 +2104,8 @@ std::string handleReportStats (TDB& tdb, T& task, Config& conf) table.addColumn ("Category"); table.addColumn ("Data"); - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) { table.setColumnUnderline (0); table.setColumnUnderline (1); @@ -2691,7 +2701,8 @@ std::string handleCustomReport ( // Common to all columns. // Add underline. - if (conf.get (std::string ("color"), true) || conf.get (std::string ("_forcecolor"), false)) + if ((conf.get (std::string ("color"), true) || conf.get (std::string ("_forcecolor"), false)) && + conf.get (std::string ("fontunderline"), "true")) table.setColumnUnderline (columnCount); else table.setTableDashedUnderline ();