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 but non-linear #117014

Closed
techsin opened this issue Feb 19, 2021 · 5 comments
Closed

Undo/Redo but non-linear #117014

techsin opened this issue Feb 19, 2021 · 5 comments
Assignees
Labels
*extension-candidate Issue identified as good extension implementation

Comments

@techsin
Copy link

techsin commented Feb 19, 2021

It'd be insanely useful to be able to go back in code and change things but still be able to come back to older most forward state.

For example, I'm coding something, I try a new approach, realize it does't work. Do bunch of undos. Get back to when code worked. Try a different approach, realize there was a utility function I could have used from previous approach here as well. But it's gone since in linear history, once you go back and make an edit, all forward history gets deleted.

Conceptually it's easy to imagine states as a tree data structure. Every time you make an edit if there is an existing child, then add another, not replace it. So instead of double linked list, it becomes a tree. However, I think what makes it or breaks this feature is the UI.

It's important to not modify undo/redo, but add to it somehow..

Some UI ideas:

  1. A shortcut that lets you cycle through branches and change file to match their leaf.
  2. Same thing as above but in a separate timeline view kinda like git diff view.
  3. GUI tree view like git graph but you can click on dots to get history

leaf = deepest child node.

@yume-chan
Copy link
Contributor

Duplicate of #20889

@techsin
Copy link
Author

techsin commented Feb 19, 2021

thanks updated the linked post, however, it seems to have gone stale.

@techsin
Copy link
Author

techsin commented Feb 19, 2021

I'd like propose another shortcut. Undo/Redo shortcuts should work linearly as they do now. Editor should know which branch the user has backtracked from and upon redoing should go back to it. But have additional shortcuts to cycle through branches. So one for up and one for down. Pressing these shortcuts will take you leaf nodes of sibling branches.

Summary of shortcuts:

  1. cmd+z = Undo
  2. cmd+shift+z = Redo
  3. ctrl+alt+cmd+down = Change to previous branch
  4. ctrl+alt+cmd+up = Change to next branch
  5. ctrl+alt+cmd+p = Mark a branch
  6. ctrl+alt+cmd+[ = Jump to marked branch (for easy jumping back to branch you are actually using)

This doesn't require GUI, GUI is nice to have but not required.

Visual Explanation

Web 1920 – 1

Furthermore, it'd be useful for last edited branch to be the most bottom branch. This way when you cycle back you always go in descending order of last modified.

@joaomoreno joaomoreno assigned eamodio and unassigned joaomoreno Feb 19, 2021
@techsin
Copy link
Author

techsin commented Feb 19, 2021

There is some vagueness in ordering branch by last modified, probably best figured out by testing it

@lramos15 lramos15 added the *extension-candidate Issue identified as good extension implementation label Oct 12, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*extension-candidate Issue identified as good extension implementation
Projects
None yet
Development

No branches or pull requests

6 participants
@joaomoreno @eamodio @yume-chan @lramos15 @techsin and others