-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "undo" #92
Comments
I think Undo is typically implemented by creating "inverse" operations and adding those to the list of operations, rather than by removing operations. The relevant paper is here. After a sync, the "inverse" may not be correct. Imagine, for example, that we create an So, more evidence that we should disallow undos after a sync. |
"Undo" as "apply the operation in reverse" matches my experience with undo in things like emacs, git This has the nice effect of undo being an undoable operation, in quite a logical manner: For example with emacs, you have operations "A, B, C". If you press undo, the operations become "A, B, C, undo to state of B". If you press undo again, another operation is added and merged with the last so you have "A, B, C, undo to state of A". If you perform some other operation "D", you end up with "A, B, C, undo to state of A, D". It also combines logical groups of operations (e.g inserting 20 characters of text) into one operation (similar to as you describe "task add" maybe being 5 low-level operations)
From a users point of view, I would expect Not sure that is necessarily easy to implement - and disallowing undo after a sync also seems pretty reasonable (although may not play well with sync being run in a cron) |
I wrote up some docs for what I've been thinking of at https://github.com/djmitche/taskchampion/pull/new/issue92 In thinking about how
The user's expectation is that this undoes the last thing that happened on that replica. But depending on what happened in the To have I think the least surprising thing to do in this case is to show an error:
this also leaves open the possibility of adding functionality there later, if we figure out what to do. |
Neat:
|
This needs some additional thought. It seems like operations would make this easy, but there are a few complicating factors;
task add
task sync
has occurredA few thoughts from a walk in the woods a few days ago:
sync
partially completes, rebasing local operations on top of new versions from the server but then failing to add a new version to the server.task add
command might add[UndoPoint, Create(..), Update(..), Update(..), Update(..)]
. UndoPoints, too, would be discarded during a sync and not sent to the server.Then
task undo
just means reversing the most recent operation and deleting it from the list of operations, repeating until an UndoPoint is seen, an irreversible operation is found, or the list of operations is exhausted.The above might make no sense by the time I or someone else reads this issue, in which case feel free to just ignore.
The text was updated successfully, but these errors were encountered: