From 861cc83e6d3f5a10fdcc7843bbdf3af054092d1c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 6 Sep 2014 15:38:25 -0400 Subject: [PATCH] TW-241 - TW-241 new column format; recur.short. - All duration columns now default to compact ISO duration format. --- ChangeLog | 1 + src/columns/ColRecur.cpp | 26 ++++++++++++++------------ src/columns/ColUDA.cpp | 4 ++-- test/uda_duration.t | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fb80896a..4bdbb7fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ Muller). - TW-221 Migrate task-faq man page to the Wiki. - TW-230 Filter tasks on partial UUIDs (thanks to Paul Kishimoto). +- TW-241 new column format; recur.short. - TW-242 extra Space when annotating a path/filename, taskopen can not open the file (thanks to Andreas Kalex). - TW-244 task add "Description (Information)" results in diff --git a/src/columns/ColRecur.cpp b/src/columns/ColRecur.cpp index 35bdeea09..f8d5407c7 100644 --- a/src/columns/ColRecur.cpp +++ b/src/columns/ColRecur.cpp @@ -82,7 +82,7 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi if (_style == "default" || _style == "duration") { - minimum = maximum = Duration (task.get ("recur")).formatCompact ().length (); + minimum = maximum = Duration (task.get ("recur")).formatISO ().length (); } else if (_style == "indicator") { @@ -100,21 +100,23 @@ void ColumnRecur::render ( int width, Color& color) { - if (_style == "default" || - _style == "duration") + if (task.has (_name)) { - lines.push_back ( - color.colorize ( - rightJustify ( - Duration (task.get ("recur")).formatCompact (), - width))); - } - else if (_style == "indicator") - { - if (task.has (_name)) + if (_style == "default" || + _style == "duration") + { + lines.push_back ( + color.colorize ( + rightJustify ( + Duration (task.get ("recur")).formatISO (), + width))); + } + else if (_style == "indicator") + { lines.push_back ( color.colorize ( rightJustify (context.config.get ("recurrence.indicator"), width))); + } } } diff --git a/src/columns/ColUDA.cpp b/src/columns/ColUDA.cpp index 5ac0bcedc..5d4bc4a21 100644 --- a/src/columns/ColUDA.cpp +++ b/src/columns/ColUDA.cpp @@ -103,7 +103,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu } else if (_type == "duration") { - minimum = maximum = utf8_width (Duration (value).formatCompact ()); + minimum = maximum = utf8_width (Duration (value).formatISO ()); } else if (_type == "string") { @@ -156,7 +156,7 @@ void ColumnUDA::render ( lines.push_back ( color.colorize ( rightJustify ( - Duration (value).formatCompact (), + Duration (value).formatISO (), width))); } else if (_type == "string") diff --git a/test/uda_duration.t b/test/uda_duration.t index 5b09394a1..0ee9cc8dc 100755 --- a/test/uda_duration.t +++ b/test/uda_duration.t @@ -55,8 +55,8 @@ if (open my $fh, '>', $rc) qx{../src/task rc:$rc add with extra:1day 2>&1}; qx{../src/task rc:$rc add without 2>&1}; my $output = qx{../src/task rc:$rc uda 2>&1}; -like ($output, qr/1\s+1d\s+with/, "$ut: UDA duration stored"); -like ($output, qr/2\s+without/, "$ut: UDA duration blank"); +like ($output, qr/1\s+P1D\s+with/, "$ut: UDA duration stored"); +like ($output, qr/2\s+without/, "$ut: UDA duration blank"); # Ensure 'extra' is stored in original form. $output = qx{../src/task rc:$rc 1 export 2>&1};