kakoune/test/compose
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
..
backward-search Expand env vars as list of strings 2020-03-02 20:53:28 +11:00
catch-error-desc Only compute command coordinates when necessary 2021-06-24 17:20:37 +10:00
complex-pipe test: Allow expect-style UI tests, testing any var 2019-10-13 14:57:24 -04:00
del-empty-line Merge overlapping selections before erasing 2015-06-28 10:16:39 +01:00
discard-selections-with-itersel Support discarding selections in exec/eval -itersel 2019-05-13 17:34:43 +10:00
do-not-run-hooks-added-by-parent Gather the list of hooks to run before running the parent 2018-12-09 10:07:40 +11:00
echo-to-file Add a -to-file <filename> switch to the echo command 2019-04-07 09:32:17 +10:00
eof-multi-delete Fix bug when deleting end of buffer text using multiple selections 2015-01-23 19:12:15 +00:00
file-expansion Add support for %file{...} expansions 2019-04-07 09:43:40 +10:00
history Switch undo storage from a tree to a plain list 2023-04-17 10:25:51 +02:00
hook-named-captures Support named captures in hooks 2019-04-15 23:56:49 +10:00
inline-sort add testing framework 2014-06-30 12:22:50 +02:00
line-completion Restore previous line-compose test 2021-04-18 16:27:15 +10:00
no-hook-on-unset-option-with-same-parent Fix hooks triggering on unset-option even if parent has same value 2018-11-28 21:45:40 +11:00
pipe-at-eof Fix additional eol inserted when replace piping at end of buffer 2015-03-06 13:57:21 +00:00
select-codepoints Add support for a -codepoint switch to the select command 2019-11-12 21:21:24 +11:00
select-display-columns The enabled check was actually was not being run by the test infrastructure. 2021-12-14 16:54:50 +05:30
select-timestamp test: Allow expect-style UI tests, testing any var 2019-10-13 14:57:24 -04:00
selections_char_desc-expansion Implement %val{selections_char_desc} 2019-11-12 20:54:32 +11:00
undo-multi-replace-at-end Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
unicode test: Fix UTF8 compliant locale detection 2017-02-23 18:46:56 +03:00