diff --git a/ChangeLog b/ChangeLog index 493b2f4d0..9005e3c08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,8 @@ report field. + New 'indent.annotation' for the 'description.default' field format. + New 'color.label' for colorizing the report column labels. + + The 'blanklines' configuration variable now replaced by the 'verbose' token + 'blanklines'. # Tracked Features, sorted by ID. + Added feature #330, which supports the 'inverse' color attribute. diff --git a/NEWS b/NEWS index c52bce947..0f4a670fd 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ New Features in taskwarrior 2.0.0 project, due date and description sorted by urgency). - Performance enhancements. - New 'next' report, that gauges urgency and reports the most urgent tasks. + - The 'blanklines' configuration variable replaced by 'verbose=...' tokens. Please refer to the ChangeLog file for full details. There are too many to list here. @@ -36,6 +37,7 @@ New configuration options in taskwarrior 2.0.0 - New 'dependency.indicator' for the 'depends.indicator' report field format. - New 'indent.annotation' for the description.default field format. - New 'color.label' for report column labels. + - New 'verbose=...' support for individual verbosity settings. Newly deprecated features in taskwarrior 2.0.0 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 6500c1908..1d9bff505 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -184,8 +184,18 @@ help text. .SS MISCELLANEOUS .TP -.B verbose=yes -Controls some of the verbosity of taskwarrior. +.B edit.verbose=on|off|list... +When set to on (the default), helpful explanatory comments are added to the +edited file when using the "task edit ..." command. Setting this to off means +that you would see minimal output, with no help text. + +Alternatively, you can specify a comma-separated list of verbosity tokens that +control specific occasions when output is generated. This list may contain: + + blanklines Inserts extra blank lines in output, for clarity + +Note that the "on" setting is equivalent to all the tokens being specified, +and the "off" setting is equivalent to none of the tokens being specified. .TP .B confirmation=yes diff --git a/scripts/vim/syntax/taskrc.vim b/scripts/vim/syntax/taskrc.vim index 2f056675a..7a02cdc7f 100644 --- a/scripts/vim/syntax/taskrc.vim +++ b/scripts/vim/syntax/taskrc.vim @@ -21,7 +21,7 @@ syn match taskrcVal ".\{-}$" contains=taskrcComment syn match taskrcEqual "=" syn match taskrcKey "^\s*.\{-}="he=e-1 contains=taskrcEqual -syn keyword taskrcGoodKey locking detection confirmation next bulk nag weekstart displayweeknumber defaultwidth editor monthsperline annotations _forcecolor blanklines debug hooks fontunderline +syn keyword taskrcGoodKey locking detection confirmation next bulk nag weekstart displayweeknumber defaultwidth editor monthsperline annotations _forcecolor debug hooks fontunderline syn match taskrcGoodKey "\(active\|tag\|recurrence\)\.indicator" syn match taskrcGoodKey "alias\.\S\{-}="he=e-1 diff --git a/src/Config.cpp b/src/Config.cpp index ea3813c5b..d5fda9a17 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -70,6 +70,8 @@ std::string Config::defaults = "\n" "# Miscellaneous\n" "verbose=yes # Provide extra feedback\n" + "#verbose=no # Provide minimal feedback\n" + "#verbose=blanklines # Provide controlled feedback\n" "confirmation=yes # Confirmation on delete, big changes\n" "echo.command=yes # Details on command just run\n" "annotations=full # Level of verbosity for annotations: full, sparse or none\n" diff --git a/src/Context.cpp b/src/Context.cpp index 294e7ecbd..37969785f 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,7 @@ Context::Context () , cmd () , dom () , use_color (true) +, verbosity_legacy (false) , inShadow (false) , terminal_width (0) , terminal_height (0) @@ -327,6 +329,24 @@ bool Context::color () config.getBoolean ("_forcecolor"); } +//////////////////////////////////////////////////////////////////////////////// +bool Context::verbose (const std::string& token) +{ + if (! verbosity.size ()) + { + verbosity_legacy = config.getBoolean ("verbose"); + split (verbosity, config.get ("verbose"), ','); + } + + if (verbosity_legacy) + return true; + + if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ()) + return true; + + return false; +} + //////////////////////////////////////////////////////////////////////////////// void Context::shadow () { diff --git a/src/Context.h b/src/Context.h index cf8139a7f..86d2a854a 100644 --- a/src/Context.h +++ b/src/Context.h @@ -60,6 +60,7 @@ public: int getHeight (); // determine terminal height bool color (); // TTY or ? + bool verbose (const std::string&); // Verbosity control void header (const std::string&); // Header message sink void footnote (const std::string&); // Footnote message sink @@ -101,6 +102,8 @@ public: DOM dom; bool use_color; + bool verbosity_legacy; + std::vector verbosity; std::vector headers; std::vector footnotes; std::vector debugMessages; diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index 0314f348b..9901a0db5 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -216,7 +216,11 @@ std::string ViewTask::render (std::vector & data, std::vector & seque out += headers[c][i]; } - out += extra + "\n"; + out += extra; + + // Trim right. + out.erase (out.find_last_not_of (" ") + 1); + out += "\n"; // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) @@ -269,7 +273,11 @@ std::string ViewTask::render (std::vector & data, std::vector & seque out += row_color.colorize (std::string (widths[c], ' ')); } - out += (odd ? extra_odd : extra_even) + "\n"; + out += (odd ? extra_odd : extra_even); + + // Trim right. + out.erase (out.find_last_not_of (" ") + 1); + out += "\n"; // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) diff --git a/src/ViewText.cpp b/src/ViewText.cpp index ac9cc28da..ebcd2df85 100644 --- a/src/ViewText.cpp +++ b/src/ViewText.cpp @@ -200,7 +200,11 @@ std::string ViewText::render () out += headers[c][i]; } - out += extra + "\n"; + out += extra; + + // Trim right. + out.erase (out.find_last_not_of (" ") + 1); + out += "\n"; // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) @@ -256,7 +260,11 @@ std::string ViewText::render () } } - out += (odd ? extra_odd : extra_even) + "\n"; + out += (odd ? extra_odd : extra_even); + + // Trim right. + out.erase (out.find_last_not_of (" ") + 1); + out += "\n"; // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) diff --git a/src/command.cpp b/src/command.cpp index 674b8474c..f04ea09bd 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -1093,7 +1093,7 @@ int handleShow (std::string& outs) // Note that there is a leading and trailing space, to make it easier to // search for whole words. std::string recognized = - " annotations blanklines bulk burndown.bias calendar.details calendar.details.report " + " annotations bulk burndown.bias calendar.details calendar.details.report " "calendar.holidays calendar.legend color calendar.offset calendar.offset.value " "color.active color.due color.due.today color.blocked color.burndown.done " "color.burndown.pending color.burndown.started color.overdue color.pri.H " diff --git a/src/custom.cpp b/src/custom.cpp index 2bcd90ae7..bdcf9ba92 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -269,7 +269,7 @@ int handleCustomReport (const std::string& report, std::string& outs) // Adjust for fluff in the output. if (maxlines) - maxlines -= (context.config.getBoolean ("blanklines") ? 1 : 0) + maxlines -= (context.verbose ("blanklines") ? 1 : 0) + table_header + context.headers.size () + context.footnotes.size (); diff --git a/src/text.cpp b/src/text.cpp index 6552738bc..8a26426c2 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -402,10 +402,7 @@ std::string ucFirst (const std::string& input) //////////////////////////////////////////////////////////////////////////////// const char* optionalBlankLine () { - if (context.config.getBoolean ("blanklines") == true) // no i18n - return newline; - - return noline; + return context.verbose ("blanklines") ? newline : noline; } ////////////////////////////////////////////////////////////////////////////////