From 1e6b30bbc9d91d1e08b6c97672fab4b935524751 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 16 Jan 2017 12:05:59 -0500 Subject: [PATCH] TW-213: Align countdown column on boundary between number and text. - Thanks to Eric Fluger. --- ChangeLog | 2 ++ src/columns/ColTypeDate.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9ecc4300..92368850a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ (thanks to Markus Beppler, Konstantin Vorobyev). - TW-61 Extract only tasks with annotations (thanks to Aikido Guy). +- TW-213 Align countdown column on boundary between number and text. + (thanks to Eric Fluger). - TW-1785 Purge command to remove deleted tasks (thanks to Paul Beckingham). - TW-1772 Implementation of circular dependency detection is diff --git a/src/columns/ColTypeDate.cpp b/src/columns/ColTypeDate.cpp index 7524ff68c..add52cdcf 100644 --- a/src/columns/ColTypeDate.cpp +++ b/src/columns/ColTypeDate.cpp @@ -61,8 +61,8 @@ ColumnTypeDate::ColumnTypeDate () format (now.toJulian (), 13, 12), now.toEpochString (), now.toISO (), - Duration (Datetime () - now).formatVague (), - '-' + Duration (Datetime () - now).formatVague (), + Duration (Datetime () - now).formatVague (true), + '-' + Duration (Datetime () - now).formatVague (true), "", Duration (Datetime () - now).format ()}; } @@ -94,7 +94,7 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m else if (_style == "countdown") { Datetime now; - minimum = maximum = Duration (now - date).formatVague ().length (); + minimum = maximum = Duration (now - date).formatVague (true).length (); } else if (_style == "julian") { @@ -112,23 +112,23 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m { Datetime now; if (now > date) - minimum = maximum = Duration (now - date).formatVague ().length (); + minimum = maximum = Duration (now - date).formatVague (true).length (); else - minimum = maximum = Duration (date - now).formatVague ().length () + 1; + minimum = maximum = Duration (date - now).formatVague (true).length () + 1; } else if (_style == "relative") { Datetime now; if (now < date) - minimum = maximum = Duration (date - now).formatVague ().length (); + minimum = maximum = Duration (date - now).formatVague (true).length (); else - minimum = maximum = Duration (now - date).formatVague ().length () + 1; + minimum = maximum = Duration (now - date).formatVague (true).length () + 1; } else if (_style == "remaining") { Datetime now; if (date > now) - minimum = maximum = Duration (date - now).formatVague ().length (); + minimum = maximum = Duration (date - now).formatVague (true).length (); } } } @@ -164,7 +164,7 @@ void ColumnTypeDate::render ( else if (_style == "countdown") { Datetime now; - renderStringRight (lines, width, color, Duration (now - date).formatVague ()); + renderStringRight (lines, width, color, Duration (now - date).formatVague (true)); } else if (_style == "julian") renderStringRight (lines, width, color, format (date.toJulian (), 13, 12)); @@ -179,24 +179,24 @@ void ColumnTypeDate::render ( { Datetime now; if (now > date) - renderStringLeft (lines, width, color, Duration (now - date).formatVague ()); + renderStringRight (lines, width, color, Duration (now - date).formatVague (true)); else - renderStringLeft (lines, width, color, '-' + Duration (date - now).formatVague ()); + renderStringRight (lines, width, color, '-' + Duration (date - now).formatVague (true)); } else if (_style == "relative") { Datetime now; if (now < date) - renderStringLeft (lines, width, color, Duration (date - now).formatVague ()); + renderStringRight (lines, width, color, Duration (date - now).formatVague (true)); else - renderStringLeft (lines, width, color, '-' + Duration (now - date).formatVague ()); + renderStringRight (lines, width, color, '-' + Duration (now - date).formatVague (true)); } else if (_style == "remaining") { Datetime now; if (date > now) - renderStringRight (lines, width, color, Duration (date - now).formatVague ()); + renderStringRight (lines, width, color, Duration (date - now).formatVague (true)); } } }