kakoune/doc/pages
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
..
buffers.asciidoc Amended grammar, punctuation, and word choice. 2022-05-17 10:39:06 -07:00
changelog.asciidoc Kakoune 2022.10.31 2022-10-31 09:05:58 +11:00
command-parsing.asciidoc command-parsing: Put balanced string examples in the right section. 2022-10-25 16:51:26 +11:00
commands.asciidoc Add -to-shell-script echo switch 2022-11-04 16:40:07 +11:00
execeval.asciidoc doc execeval: mention that the colon register is saved by default 2022-08-01 07:15:08 +02:00
expansions.asciidoc Switch undo storage from a tree to a plain list 2023-04-17 10:25:51 +02:00
faces.asciidoc Made changes suggested by krobelus 2022-07-26 13:42:28 -07:00
faq.asciidoc doc faq: Document the frugal scripting language 2020-08-10 12:23:35 +03:00
highlighters.asciidoc highlighter doc: some clarificatory edits 2022-05-23 16:52:30 +05:30
hooks.asciidoc {commands,hooks}.asciidoc: Use consistent capitalization for Kakoune 2021-05-15 22:17:41 -04:00
keymap.asciidoc doc keymap: update for <space>/, swap 2022-08-17 00:48:12 +02:00
keys.asciidoc Switch undo storage from a tree to a plain list 2023-04-17 10:25:51 +02:00
mapping.asciidoc Remove unnecessary leading space in prompt from mappings 2022-08-01 07:37:02 +02:00
modes.asciidoc Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
options.asciidoc Add option to set maximum info box width 2023-02-15 21:17:22 -05:00
regex.asciidoc doc regex: Avoid confusion in relationship with ECMAScript 2021-10-29 19:21:50 +02:00
registers.asciidoc Merge remote-tracking branch 'krobelus/document-history-registers' 2022-08-03 19:51:22 +10:00
scopes.asciidoc doc: Document the buffer=/path/to/file scope syntax. 2019-01-23 12:34:02 +11:00