mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement
- Swapped std::string::find for find (from text.cpp) to allow configurable case sensitivity.
This commit is contained in:
parent
99bce308e6
commit
4f4a32b405
1 changed files with 23 additions and 18 deletions
|
@ -735,7 +735,7 @@ int handleShow (std::string &outs)
|
||||||
|
|
||||||
out << std::endl
|
out << std::endl
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< (table.rowCount () == 0 ? "No matching configuration variables\n" : "")
|
<< (table.rowCount () == 0 ? "No matching configuration variables\n" : "")
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Display the unrecognized variables.
|
// Display the unrecognized variables.
|
||||||
|
@ -2036,6 +2036,8 @@ int handleDenotate (std::string &outs)
|
||||||
if (context.sequence.size () == 0)
|
if (context.sequence.size () == 0)
|
||||||
throw std::string ("A task ID is needed to delete an annotation.");
|
throw std::string ("A task ID is needed to delete an annotation.");
|
||||||
|
|
||||||
|
bool sensitive = context.config.getBoolean ("search.case.sensitive");
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
std::vector <Task> tasks;
|
std::vector <Task> tasks;
|
||||||
|
@ -2065,29 +2067,31 @@ int handleDenotate (std::string &outs)
|
||||||
for (i = annotations.begin (); i != annotations.end (); ++i)
|
for (i = annotations.begin (); i != annotations.end (); ++i)
|
||||||
{
|
{
|
||||||
anno = i->value ();
|
anno = i->value ();
|
||||||
if (anno == desc)
|
if (anno == desc)
|
||||||
{
|
{
|
||||||
match = true;
|
match = true;
|
||||||
annotations.erase (i);
|
annotations.erase (i);
|
||||||
task->setAnnotations (annotations);
|
task->setAnnotations (annotations);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!match)
|
if (!match)
|
||||||
{
|
{
|
||||||
for (i = annotations.begin (); i != annotations.end (); ++i)
|
for (i = annotations.begin (); i != annotations.end (); ++i)
|
||||||
{
|
{
|
||||||
anno = i->value ();
|
anno = i->value ();
|
||||||
std::string::size_type loc = anno.find (desc, 0);
|
std::string::size_type loc = find (anno, desc, sensitive);
|
||||||
if (loc != std::string::npos && loc == 0)
|
|
||||||
{
|
if (loc != std::string::npos && loc == 0)
|
||||||
match = true;
|
{
|
||||||
annotations.erase (i);
|
match = true;
|
||||||
|
annotations.erase (i);
|
||||||
task->setAnnotations (annotations);
|
task->setAnnotations (annotations);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskDiff (before, *task))
|
if (taskDiff (before, *task))
|
||||||
{
|
{
|
||||||
if (permission.confirmed (before, taskDifferences (before, *task) + "Proceed with change?"))
|
if (permission.confirmed (before, taskDifferences (before, *task) + "Proceed with change?"))
|
||||||
|
@ -2102,9 +2106,9 @@ int handleDenotate (std::string &outs)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << "Did not find any matching annotation to be deleted for '"
|
out << "Did not find any matching annotation to be deleted for '"
|
||||||
<< desc
|
<< desc
|
||||||
<< "'."
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
|
@ -2113,6 +2117,7 @@ int handleDenotate (std::string &outs)
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-denotate-command");
|
context.hooks.trigger ("post-denotate-command");
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue