From e4b9c1f01ec1b6c3a6c1f47597e1bde3788dd83a Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Fri, 5 Jun 2015 22:25:48 +0200 Subject: [PATCH] Fix "task edit" dropping annotation text after newlines. --- ChangeLog | 1 + src/commands/CmdEdit.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 924ca68b1..3725ea5e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ Harlan). - TW-1572 Better urgency inheritance (thanks to Jens Erat). - Prevent potential task duplication during import for non-pending tasks. - Show the active context in "context list", if any is active. +- Fix "task edit" dropping annotation text after newlines. ------ current release --------------------------- diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 574a54bac..07362330e 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -40,6 +40,7 @@ #include #include #include +#include extern Context context; @@ -239,7 +240,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat) { Date dt (strtol (anno.first.substr (11).c_str (), NULL, 10)); before << " Annotation: " << dt.toString (dateformat) - << " -- " << anno.second << "\n"; + << " -- " << json::encode (anno.second) << "\n"; } Date now; @@ -639,7 +640,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string std::stringstream name; name << "annotation_" << when.toEpoch (); std::string text = trim (value.substr (gap + 4), "\t "); - annotations.insert (std::make_pair (name.str (), text)); + annotations.insert (std::make_pair (name.str (), json::decode (text))); } } }