- TW-288 `task edit` mangles descriptions with embedded newlines (thanks to
         Kevin Ballard).
This commit is contained in:
Paul Beckingham 2014-07-06 12:14:44 -04:00
parent 68ceea953a
commit 0c1fa8b20e
4 changed files with 26 additions and 2 deletions

View file

@ -220,3 +220,4 @@ suggestions:
Will Dietz
Charles Ulrich
Jack
Kevin Ballard

View file

@ -63,6 +63,8 @@
- TW-279 ".monthly" unexpectedly appended to task annotation (thanks to Florian
Hollerweger).
- TW-285 DUETODAY doesn't give any output (thanks to Jostein Berntsen).
- TW-288 `task edit` mangles descriptions with embedded newlines (thanks to
Kevin Ballard).
- TW-294 Display UUID of task created by add (thanks to John West).
- TW-306 Wrong date format in burndown view (thanks to Michele Santullo).
- TW-752 task ID no longer defaults to info (thanks to Christopher Roberts).

View file

@ -97,6 +97,26 @@ std::string CmdEdit::findValue (
return "";
}
////////////////////////////////////////////////////////////////////////////////
std::string CmdEdit::findMultilineValue (
const std::string& text,
const std::string& startMarker,
const std::string& endMarker)
{
std::string::size_type start = text.find (startMarker);
if (start != std::string::npos)
{
std::string::size_type end = text.find (endMarker, start);
if (end != std::string::npos)
{
std::string value = text.substr (start + startMarker.length (),
end - (start + startMarker.length ()));
return trim (value, "\t ");
}
}
return "";
}
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string> CmdEdit::findValues (
const std::string& text,
@ -351,7 +371,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
task.addTags (tags);
// description.
value = findValue (after, "\n Description:");
value = findMultilineValue (after, "\n Description:", "\n Created:");
if (task.get ("description") != value)
{
if (value != "")
@ -717,7 +737,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
}
}
}
// UDA orphans
std::vector <std::string> orphanValues = findValues (after, "\n UDA Orphan ");
std::vector <std::string>::iterator orphan;

View file

@ -39,6 +39,7 @@ public:
private:
std::string findValue (const std::string&, const std::string&);
std::string findMultilineValue (const std::string&, const std::string&, const std::string&);
std::vector <std::string> findValues (const std::string&, const std::string&);
std::string formatDate (Task&, const std::string&, const std::string&);
std::string formatDuration (Task&, const std::string&);