diff --git a/ChangeLog b/ChangeLog index 6799fe29d..f8d7aa5bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ + Fixed bug that caused recurring annual tasks to exhibit a creeping due date, because of an assumption of 365 days per year, which failed to consider leap years (thanks to T. Charles Yun). + + Annotations can now be modified with the substitution commands /from/to/. ------ old releases ------------------------------ diff --git a/html/advanced.html b/html/advanced.html index fed284b47..49c2d5b29 100644 --- a/html/advanced.html +++ b/html/advanced.html @@ -312,6 +312,11 @@ ID Project Pri Description This command makes single corrections to a task description.

+

+ If a task is annotated, the annotation can be modified using + this command. +

+ % task tags

This command will generate a list of all the tags that are currently diff --git a/html/task.html b/html/task.html index 4d3ef70bd..0fbfbee90 100644 --- a/html/task.html +++ b/html/task.html @@ -144,6 +144,7 @@

  • Fixed bug that caused recurring annual tasks to exhibit a creeping due date, because of an assumption of 365 days per year, which failed to consider leap years (thanks to T. Charles Yun). +
  • Annotations can now be modified with the substitution commands /from/to/.

    diff --git a/src/T.cpp b/src/T.cpp index cb5100653..117a46d80 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -254,11 +254,17 @@ void T::setSubstitution (const std::string& from, const std::string& to) } //////////////////////////////////////////////////////////////////////////////// -void T::getAnnotations (std::map & all) +void T::getAnnotations (std::map & all) const { all = mAnnotations; } +//////////////////////////////////////////////////////////////////////////////// +void T::setAnnotations (const std::map & all) +{ + mAnnotations = all; +} + //////////////////////////////////////////////////////////////////////////////// void T::addAnnotation (const std::string& description) { diff --git a/src/T.h b/src/T.h index 4113b2f93..35966ebb7 100644 --- a/src/T.h +++ b/src/T.h @@ -79,7 +79,8 @@ public: void removeAttribute (const std::string&); void removeAttributes (); - void getAnnotations (std::map &); + void getAnnotations (std::map &) const; + void setAnnotations (const std::map &); void addAnnotation (const std::string&); const std::string compose () const; diff --git a/src/command.cpp b/src/command.cpp index 85fe22a21..3912f057e 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -769,6 +769,28 @@ std::string handleModify (TDB& tdb, T& task, Config& conf) original.setDescription (description); ++changes; } + else + { + std::map annotations; + original.getAnnotations (annotations); + + std::map ::iterator it; + for (it = annotations.begin (); it != annotations.end (); ++it) + { + size_t pattern = it->second.find (from); + if (pattern != std::string::npos) + { + it->second = it->second.substr (0, pattern) + + to + + it->second.substr (pattern + from.length (), std::string::npos); + ++changes; + break; + } + } + + if (changes) + original.setAnnotations (annotations); + } } if (changes)