mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-288
- TW-288 `task edit` mangles descriptions with embedded newlines (thanks to Kevin Ballard).
This commit is contained in:
parent
68ceea953a
commit
0c1fa8b20e
4 changed files with 26 additions and 2 deletions
1
AUTHORS
1
AUTHORS
|
@ -220,3 +220,4 @@ suggestions:
|
|||
Will Dietz
|
||||
Charles Ulrich
|
||||
Jack
|
||||
Kevin Ballard
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue