mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - annotation substitution
- Annotations are now modifiable using the /from/to/ modification command.
This commit is contained in:
parent
daea320564
commit
a6b45af0a2
6 changed files with 38 additions and 2 deletions
|
@ -39,6 +39,7 @@
|
||||||
+ Fixed bug that caused recurring annual tasks to exhibit a creeping due
|
+ 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
|
date, because of an assumption of 365 days per year, which failed to
|
||||||
consider leap years (thanks to T. Charles Yun).
|
consider leap years (thanks to T. Charles Yun).
|
||||||
|
+ Annotations can now be modified with the substitution commands /from/to/.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,11 @@ ID Project Pri Description
|
||||||
This command makes single corrections to a task description.
|
This command makes single corrections to a task description.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If a task is annotated, the annotation can be modified using
|
||||||
|
this command.
|
||||||
|
</p>
|
||||||
|
|
||||||
<strong>% task tags</strong>
|
<strong>% task tags</strong>
|
||||||
<p>
|
<p>
|
||||||
This command will generate a list of all the tags that are currently
|
This command will generate a list of all the tags that are currently
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
<li>Fixed bug that caused recurring annual tasks to exhibit a creeping due
|
<li>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
|
date, because of an assumption of 365 days per year, which failed to
|
||||||
consider leap years (thanks to T. Charles Yun).
|
consider leap years (thanks to T. Charles Yun).
|
||||||
|
<li>Annotations can now be modified with the substitution commands /from/to/.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -254,11 +254,17 @@ void T::setSubstitution (const std::string& from, const std::string& to)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void T::getAnnotations (std::map <time_t, std::string>& all)
|
void T::getAnnotations (std::map <time_t, std::string>& all) const
|
||||||
{
|
{
|
||||||
all = mAnnotations;
|
all = mAnnotations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void T::setAnnotations (const std::map <time_t, std::string>& all)
|
||||||
|
{
|
||||||
|
mAnnotations = all;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void T::addAnnotation (const std::string& description)
|
void T::addAnnotation (const std::string& description)
|
||||||
{
|
{
|
||||||
|
|
3
src/T.h
3
src/T.h
|
@ -79,7 +79,8 @@ public:
|
||||||
void removeAttribute (const std::string&);
|
void removeAttribute (const std::string&);
|
||||||
void removeAttributes ();
|
void removeAttributes ();
|
||||||
|
|
||||||
void getAnnotations (std::map <time_t, std::string>&);
|
void getAnnotations (std::map <time_t, std::string>&) const;
|
||||||
|
void setAnnotations (const std::map <time_t, std::string>&);
|
||||||
void addAnnotation (const std::string&);
|
void addAnnotation (const std::string&);
|
||||||
|
|
||||||
const std::string compose () const;
|
const std::string compose () const;
|
||||||
|
|
|
@ -769,6 +769,28 @@ std::string handleModify (TDB& tdb, T& task, Config& conf)
|
||||||
original.setDescription (description);
|
original.setDescription (description);
|
||||||
++changes;
|
++changes;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::map <time_t, std::string> annotations;
|
||||||
|
original.getAnnotations (annotations);
|
||||||
|
|
||||||
|
std::map <time_t, std::string>::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)
|
if (changes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue