Our great sponsors
-
immer
Postmodern immutable and persistent data structures for C++ — value semantics at scale (by arximboldi)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
I've been working on an editor (not text) in C++ and pretty early got into undo/redo. I went down the route of doIt/undoIt for commands but that quickly got old. There was both the extra work needed to implement undo separately for every operation, but also the nagging feeling that the undo operation for some operation wasn't implemented correctly.
In the end, I switched to representing the entire document state using persistent data structures (using the immer library). This vastly simplified things and implementing undo/redo becomes absolutely trivial when using persistent data structures. It's probably not something that is suitable for all domains, but worth checking out.
https://github.com/arximboldi/immer
vundo is a simpler implementation: it reuses Emacs's tree and just implements the visualisation part.
undo-tree is a reimplementation of Emacs's tree based undo, that supports a visualization.
* undo-tree LOC: 4700. https://gitlab.com/tsc25/undo-tree/-/blob/master/undo-tree.e...
* vundo LOC: 1350. https://github.com/casouri/vundo/blob/master/vundo.el
vundo is a simpler implementation: it reuses Emacs's tree and just implements the visualisation part.
undo-tree is a reimplementation of Emacs's tree based undo, that supports a visualization.
* undo-tree LOC: 4700. https://gitlab.com/tsc25/undo-tree/-/blob/master/undo-tree.e...
* vundo LOC: 1350. https://github.com/casouri/vundo/blob/master/vundo.el