Bug #653
- Fixed bug #653, which caused undo information to be recorded when no changes were made by the 'edit' command.
This commit is contained in:
@@ -104,6 +104,8 @@
|
|||||||
'dateformat.report'.
|
'dateformat.report'.
|
||||||
+ Fixed bug #651, which broke the edit command when a task description
|
+ Fixed bug #651, which broke the edit command when a task description
|
||||||
contained certain tokens (like 'Due:').
|
contained certain tokens (like 'Due:').
|
||||||
|
+ Fixed bug #653, which caused undo information to be recorded when no changes
|
||||||
|
were made by the 'edit' command.
|
||||||
+ Fixed bug #654, which broke the info command when a task had no journal
|
+ Fixed bug #654, which broke the info command when a task had no journal
|
||||||
entries.
|
entries.
|
||||||
+ Fixed bug #656, which caused multiple recurring child tasks to be created
|
+ Fixed bug #656, which caused multiple recurring child tasks to be created
|
||||||
|
|||||||
41
src/edit.cpp
41
src/edit.cpp
@@ -556,7 +556,7 @@ static void parseTask (Task& task, const std::string& after)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void editFile (Task& task)
|
bool editFile (Task& task)
|
||||||
{
|
{
|
||||||
// Check for file permissions.
|
// Check for file permissions.
|
||||||
Directory location (context.config.get ("data.location"));
|
Directory location (context.config.get ("data.location"));
|
||||||
@@ -587,6 +587,8 @@ void editFile (Task& task)
|
|||||||
editor += "\"" + file.str () + "\"";
|
editor += "\"" + file.str () + "\"";
|
||||||
|
|
||||||
ARE_THESE_REALLY_HARMFUL:
|
ARE_THESE_REALLY_HARMFUL:
|
||||||
|
bool changes = false; // No changes made.
|
||||||
|
|
||||||
// Launch the editor.
|
// Launch the editor.
|
||||||
std::cout << "Launching '" << editor << "' now...\n";
|
std::cout << "Launching '" << editor << "' now...\n";
|
||||||
if (-1 == system (editor.c_str ()))
|
if (-1 == system (editor.c_str ()))
|
||||||
@@ -628,12 +630,18 @@ ARE_THESE_REALLY_HARMFUL:
|
|||||||
if (confirm ("Taskwarrior couldn't handle your edits. Would you like to try again?"))
|
if (confirm ("Taskwarrior couldn't handle your edits. Would you like to try again?"))
|
||||||
goto ARE_THESE_REALLY_HARMFUL;
|
goto ARE_THESE_REALLY_HARMFUL;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
changes = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
std::cout << "No edits were detected.\n";
|
std::cout << "No edits were detected.\n";
|
||||||
|
changes = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
File::remove (file.str ());
|
File::remove (file.str ());
|
||||||
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -660,35 +668,8 @@ int handleEdit (std::string& outs)
|
|||||||
|
|
||||||
std::vector <Task>::iterator task;
|
std::vector <Task>::iterator task;
|
||||||
for (task = tasks.begin (); task != tasks.end (); ++task)
|
for (task = tasks.begin (); task != tasks.end (); ++task)
|
||||||
{
|
if (editFile (*task))
|
||||||
editFile (*task);
|
context.tdb.update (*task);
|
||||||
context.tdb.update (*task);
|
|
||||||
/*
|
|
||||||
TODO Figure out what this is. I can't remember, but don't want to remove
|
|
||||||
it until I do.
|
|
||||||
|
|
||||||
std::vector <Task>::iterator other;
|
|
||||||
for (other = all.begin (); other != all.end (); ++other)
|
|
||||||
{
|
|
||||||
if (other->id != task.id) // Don't edit the same task again.
|
|
||||||
{
|
|
||||||
if (task.has ("parent") &&
|
|
||||||
if (other is parent of task)
|
|
||||||
{
|
|
||||||
// Transfer everything but mask, imask, uuid, parent.
|
|
||||||
}
|
|
||||||
else if (task is parent of other)
|
|
||||||
{
|
|
||||||
// Transfer everything but mask, imask, uuid, parent.
|
|
||||||
}
|
|
||||||
else if (task and other are siblings)
|
|
||||||
{
|
|
||||||
// Transfer everything but mask, imask, uuid, parent.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|||||||
Reference in New Issue
Block a user