Skip to content
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

Undo/Redo (with snapshots + one-way commands) #1900

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

matthew-carroll
Copy link
Contributor

Undo/Redo (with snapshots + one-way commands)

This is an undo/redo concept that's intended to avoid some of the complexities of the reversible command undo/redo version (#1881) by using Editable state snapshots, combined with a history of one-way EditCommands.

With this approach, when the user wants to undo a change, the Editables are completely reverted to their most recent "snapshot" and then all historical EditCommands are replayed, except the most recent EditCommand, thus achieving undo.

This approach requires that Editables be capable of providing some kind of immutable snapshot. It might be a Dart data structure, it might be JSON, etc. The format doesn't matter. Each Editable needs to be able to provide some kind of snapshot, and then restore itself with that snapshot. This approach also re-runs a number of commands when undo'ing the previous command. This extra compute cost allows us to avoid the complexity of implementing reversible commands.

@alterhuman
Copy link

@matthew-carroll sorry for bothering with an update comment but have been waiting for undo/redo since a long time and just wanted to know whether it's being worked on or if there is a blocker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants