From 1cbec205f12e8764e61d70c277c1b87cdb6e93fd Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 11 Apr 2009 23:02:48 -0400 Subject: [PATCH] Bug Fix - concatenation of colons in description - When a task description contained a colon, the two words preceding the colon were concatenated. For example, "aa bb:cc dd" gets concatenated to "aabb:cc dd". - Added unit to test to prevent regression. - Updated documentation. --- ChangeLog | 2 ++ html/task.html | 2 ++ src/parse.cpp | 8 ++++++-- src/tests/bug.concat.t | 15 +++++++++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 043c48dbf..19b99bac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,8 @@ is a recurring task. This column can be added to any custom report. + Added new column 'tag_indicator' that displays a '+' if the task has any tags. This column can be added to any custom report. + + Fixed bug where sometimes a task description was concatenated oddly if + there was a colon somewhere in the description. ------ old releases ------------------------------ diff --git a/html/task.html b/html/task.html index 1a157513d..b5bbd2f5b 100644 --- a/html/task.html +++ b/html/task.html @@ -139,6 +139,8 @@ is a recurring task. This column can be added to any custom report.
  • Added new column 'tag_indicator' that displays a '+' if the task has any tags. This column can be added to any custom report. +
  • Fixed bug where sometimes a task description was concatenated oddly if + there was a colon somewhere in the description.

    diff --git a/src/parse.cpp b/src/parse.cpp index e6923c589..110877aab 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -443,7 +443,11 @@ void parse ( // If it is not a valid attribute, then allow the argument as part of // the description. else + { + if (descCandidate.length ()) + descCandidate += " "; descCandidate += arg; + } } // Substitution of description text. @@ -462,7 +466,7 @@ void parse ( { if (descCandidate.length ()) descCandidate += " "; - descCandidate += std::string (arg); + descCandidate += arg; } } @@ -471,7 +475,7 @@ void parse ( { if (descCandidate.length ()) descCandidate += " "; - descCandidate += std::string (arg); + descCandidate += arg; } } } diff --git a/src/tests/bug.concat.t b/src/tests/bug.concat.t index 74a82896f..4a3fcd1f5 100755 --- a/src/tests/bug.concat.t +++ b/src/tests/bug.concat.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 6; # Create the rc file. if (open my $fh, '>', 'bug_concat.rc') @@ -47,7 +47,6 @@ if (open my $fh, '>', 'bug_concat.rc') # Thisisanewdescription qx{../task rc:bug_concat.rc add This is the original text}; - my $output = qx{../task rc:bug_concat.rc info 1}; like ($output, qr/Description\s+This is the original text\n/, 'original correct'); @@ -55,6 +54,18 @@ qx{../task rc:bug_concat.rc 1 This is the modified text}; $output = qx{../task rc:bug_concat.rc info 1}; like ($output, qr/Description\s+This is the modified text\n/, 'modified correct'); +# When a task is added like this: +# +# % task add aaa bbb:ccc ddd +# +# The description is concatenated thus: +# +# aaabbb:ccc ddd + +qx{../task rc:bug_concat.rc add aaa bbb:ccc ddd}; +$output = qx{../task rc:bug_concat.rc info 2}; +like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated'); + # Cleanup. unlink 'pending.data'; ok (!-r 'pending.data', 'Removed pending.data');