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

[WIP] Undo/redo history branching #27302

Closed
wants to merge 1 commit into from
Closed

Conversation

Zalastax
Copy link

I tried to get feedback in #20889 before opening this PR, as the changes are rather large and needs input from corresponding stakeholders, but I've not gotten a response in months. The issue contains details about what I find unclear / needs improvement so I'll not duplicate that here.

@mention-bot
Copy link

@Zalastax, thanks for your PR! By analyzing the history of the files in this pull request, we identified @egamma and @alexandrudima to be potential reviewers.

This enables multiple redo futures,
a feature available in editors such as vim and emacs.
Undo branches / undo tree allows you to undo some changes,
then make a new change, while keeping all changes available in the undo tree.
The undo tree can therefore prevent awkward scenarios such as:
 * Losing all redo futures by accidentally pressing a button during undo
  * Copying the file or save it with git when trying multiple
  alternatives

It's implemented by modifying the edit stack elements to keep track of
all possible futures, instead of throwing alternative futures away.
A new event has been added, notifying all movement in the tree.

The method moveTo is used to move to a certain node in the tree, by
providing its index (a unique and ordered number). This index is used
to find the common ancestor of the current node and the target node.
The undo/redo path through the common ancestor is the shortest number of
transformations needed to go from the current node to the target.

The history tree is visualized in a contrib plugin on two overlayed
canvases, to enable some future optimizations.
The node position calculation of the visualization is cached,
but several more calculations have further optimization potential.
@Zalastax Zalastax closed this Dec 15, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants