kakoune/doc
Olivier Perret e0d33f51b3 Switch undo storage from a tree to a plain list
Whenever a new history node is committed after some undo steps, instead
of creating a new branch in the undo graph, we first append the inverse
modifications starting from the end of the undo list up to the current
position before adding the new node.

For example let's assume that the undo history is A-B-C, that a single undo
has been done (bringing us to state B) and that a new change D is committed.
Instead of creating a new branch starting at B, we add the inverse of C
(noted ^C) at the end, and D afterwards. This results in the undo history
A-B-C-^C-D. Since C-^C collapses to a null change, this is equivalent to
A-B-D but without having lost the C branch of the history.

If a new change is committed while no undo has been done, the new history
node is simply appended to the list, as was the case previously.

This results in a simplification of the user interaction, as two bindings
are now sufficient to walk the entire undo history, as opposed to needing
extra bindings to switch branches whenever they occur.
The <a-u> and <a-U> bindings are now free.

It also simplifies the implementation, as the graph traversal and
branching code are not needed anymore. The parent and child of a node are
now respectively the previous and the next elements in the list, so there
is no need to store their ID as part of the node.
Only the committing of an undo group is slightly more complex, as inverse
history nodes need to be added depending on the current position in the
undo list.

The following article was the initial motivation for this change:
https://github.com/zaboople/klonk/blob/master/TheGURQ.md
2023-04-17 10:25:51 +02:00
..
pages Switch undo storage from a tree to a plain list 2023-04-17 10:25:51 +02:00
autoedit.asciidoc doc: fix typos and clarify some parts 2020-05-28 18:37:26 +02:00
coding-style.asciidoc Rename NCursesUI to TerminalUI 2021-07-12 10:25:58 +10:00
design.asciidoc Edit high-level design doc for ease of reading 2021-03-17 22:12:17 -04:00
interfacing.asciidoc Change completions option docstring element to be an arbitrary command 2019-04-17 08:38:52 +02:00
json_ui.asciidoc Refactor mouse press/release handling to support 3 buttons 2020-06-28 19:48:55 +10:00
kak.1 Describe 'filter mode' in more detail. 2021-12-13 09:05:22 +11:00
kakoune_logo.svg Add logo proposal. 2015-03-22 14:09:32 +01:00
screenshot-i3.gif Add some screenshots to README 2015-05-07 00:34:50 +01:00
screenshot-tmux.gif Add some screenshots to README 2015-05-07 00:34:50 +01:00
writing_scripts.asciidoc doc writing_scripts: Document echo portability issues 2020-05-04 12:10:23 +00:00