From 3f8095166e91d2f17a195080426d24eb4cf07735 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 27 Dec 2014 15:30:41 -0500 Subject: [PATCH] TW-161 - TW-161 UDA indicator (thanks to Jim B). --- ChangeLog | 1 + NEWS | 2 ++ doc/man/taskrc.5.in | 4 ++++ src/columns/ColUDA.cpp | 15 +++++++++++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4410cf89f..3fdd88266 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,7 @@ - TW-139 Possibility to execute shadow file generation (thanks to Arnoud K). - TW-145 default.due should accept a Duration (thanks to Ozgur Akgun). - TW-159 show sort field(s) as bold in listing headers. +- TW-161 UDA indicator (thanks to Jim B). - TW-168 modification of due date relative to current due date (thanks to Dirk Sarpe). - TW-186 Increase for numerical UDAs (thanks to Steffen Uhlig). diff --git a/NEWS b/NEWS index c274af47c..f18630d16 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ New Features in taskwarrior 2.4.0 - The filter form 'name:value' now maps to the partial match operator '=', rather than the exact match operator, '=='. This means that dates now match on the day by default, not the time also. + - UDA indicator format. - Hooks. - New and updated holidays.rc files. @@ -47,6 +48,7 @@ New configuration options in taskwarrior 2.4.0 urgency. - New 'recurrence.confirmation' which allows bypassing confirmation for changes to recurring tasks, by accepting, rejecting or prompting. + - New 'uda..indicator' to override the UDA indicator. Newly deprecated features in taskwarrior 2.4.0 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 02e130789..513168b90 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -408,6 +408,10 @@ The character or string to show in the tag.indicator column. Defaults to +. .B dependency.indicator=D The character or string to show in the depends.indicator column. Defaults to +. +.TP +.B uda..indicator=U +The character or string to show in the .indicator column. Defaults to U. + .TP .B recurrence.confirmation=prompt Controls whether changes to recurring tasks propagates to other child tasks with diff --git a/src/columns/ColUDA.cpp b/src/columns/ColUDA.cpp index 5d4bc4a21..2c9be0f24 100644 --- a/src/columns/ColUDA.cpp +++ b/src/columns/ColUDA.cpp @@ -48,8 +48,7 @@ ColumnUDA::ColumnUDA () _hyphenate = (_type == "string") ? true : false; _styles.push_back (_style); - - // TODO _examples.push_back ("?"); + _styles.push_back ("indicator"); } //////////////////////////////////////////////////////////////////////////////// @@ -117,6 +116,11 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu } } } + else if (_style == "indicator") + { + if (task.has (_name)) + minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator")); + } else throw format (STRING_COLUMN_BAD_FORMAT, _name, _style); } @@ -174,6 +178,13 @@ void ColumnUDA::render ( } } } + else if (_style == "indicator") + { + if (task.has (_name)) + lines.push_back ( + color.colorize ( + rightJustify (context.config.get ("uda." + _name + ".indicator"), width))); + } } ////////////////////////////////////////////////////////////////////////////////