Skip to content

Correctly do undo-redo #85

@stefnotch

Description

@stefnotch

No need for a tree. Just do https://github.com/zaboople/klonk/blob/master/TheGURQ.md

Aka

  • Undo stack (as per usual)
  • Redo stack (as per usual)

But with one special tweak

  1. Undo puts stuff on the redo stack (as per usual)
  2. Now I start editing
  3. So I grab the entire redo stack, and put it onto the undo stack (going to the present before the undos)
  4. Then I undo all these changes, putting that onto the undo stack (going to the point in time where I am)
  5. And now I can put my edits onto the undo stack

Thus, it gives us a linear history that looks like
edits => doing edits backwards => new edits

Emacs does that as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions