Closed wkurniawan07 closed 10 years ago
We might need to rethink our architecture and add an executor component, so that we can track modifications for implementation of this undo feature. I'm not sure if there's any other way, please enlighten me...
My thought: maintain a stack of inputs. For every action done, add the opposite action to the stack (e.g "add task a" => "delete task a", "update_desc some_description" => "update_desc old_description", "mark as done" => "mark as not done", ...). To undo just pop the stack and run the input.
You are right. But how does the stck know if the input is carried out successfully? Or valid...
we can always tweak it in such a way that the opposite command is only added upon successful action. I don't think it's hard to do, hope I'm not wrong. then again, for undo commands to work, all commands need to be well-defined and finalized first. I think this can be left for now, until we're more ready.
Alright then. Cool. I'll look into it once the main commands are done. Thanks
It seems this issue will never be close as long as we add new commands which need an inverse command.
however, considering the undo framework is working smoothly, this issue can be closed.
so that I can obtain the information stored before in case anything goes wrong.