Hacker News new | ask | show | jobs
by bobbylarrybobby 1944 days ago
This was my first thought. A timeline is nice, but the problem with a linear undo history is that if you undo and then edit, you lose access to the state before you undid. A tree is clearly the right structure for undo history.
2 comments

You could just append a new state to the end of the timeline when you “undo”, so you never lose history. This is how undo works in Emacs by default.
Heck it's how boring business apps handle bookkeeping data since forever. You never delete a record to correct a mistake, you create a new record to do it.
The tree structure is inherently flawed for storing undos when using features like undoing within a specific region, because the new state doesn't map to any previous node on the tree.

By default, Emacs has a linear undo structure, while still allowing you to never lose history.