Commit Graph

37 Commits

Author SHA1 Message Date
Maxime Coste
5901d2e06b Revert "Switch undo storage from a tree to a plain list"
Moving across history moved to <c-j>/<c-k> to keep <a-u>/<a-U>
for selection undo/redo

This reverts commit e0d33f51b3.
2023-06-17 17:31:57 +10:00
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
Maxime Coste
2d8456db10 Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
Sidharth Kshatriya
e013385a58 The enabled check was actually was not being run by the test infrastructure.
Now that it is, we get the following error when trying to execute
`test/compose/select-display-columns`

```sh
./enabled: 2: [: 4: unexpected operator
```

This commit fixes the enabled check
2021-12-14 16:54:50 +05:30
Maxime Coste
be9b2de0ee Only compute command coordinates when necessary
Tracking the line/column of each token takes a surprising big part
of the command parsing logic runtime and is only necessary when we
hit an error.
2021-06-24 17:20:37 +10:00
Maxime Coste
6f56f02924 Restore previous line-compose test 2021-04-18 16:27:15 +10:00
Tw
41833d7b7d fix line completion with prefix
There's a bug in current line completion, fix it.

Signed-off-by: Tw <tw19881113@gmail.com>
2021-04-11 11:54:48 +08:00
Andrew Vos
f3f3f80624
Ignore indent when completing lines
When doing line completion, we previously used to not complete the line
if it had different indent to the potential completion.

This commit changes the behaviour to ignore indentation when completing lines.
2020-11-20 20:00:46 +00:00
Maxime Coste
0a66eb9c47 Expand env vars as list of strings
This makes it possible to do :select `%val{selections_decs}` and to
correctly combine $kak_quoted with those.
2020-03-02 20:53:28 +11:00
Maxime Coste
8b6ed26e8c Few style changes on history exposition code 2020-01-02 22:36:26 +11:00
Jason Felice
b03b51d27a Add 'history' and 'uncommitted_modifications' expansions 2020-01-01 19:47:29 -05:00
Maxime Coste
4d7ea276c4 Use fullwidth latin character in test to try to fix travis 2019-11-18 23:00:19 +11:00
Maxime Coste
25429a905b Try to fix select-display-column test 2019-11-17 10:52:25 +11:00
Maxime Coste
f9d3b0f671 Add select display columns test 2019-11-13 20:13:49 +11:00
Maxime Coste
7a8f57f97b Add support for a -codepoint switch to the select command 2019-11-12 21:21:24 +11:00
Jason Felice
5fae16faef Implement %val{selections_char_desc}
Fixes #3194
2019-11-12 20:54:32 +11:00
Jason Felice
e888f4341c test: Allow expect-style UI tests, testing any var 2019-10-13 14:57:24 -04:00
Maxime Coste
91386a535c Support discarding selections in exec/eval -itersel
Only fail if all selections are discarded.
Fixes #2841
2019-05-13 17:34:43 +10:00
Maxime Coste
6b79c1e000 Support named captures in hooks
Fixes #2857
2019-04-15 23:56:49 +10:00
Maxime Coste
41f19f8dc9 Add support for %file{...} expansions
This should make the use case exposed in #2836 implementable.
2019-04-07 09:43:40 +10:00
Maxime Coste
744778be30 Add a -to-file <filename> switch to the echo command
As discussed in #2836
2019-04-07 09:32:17 +10:00
Maxime Coste
baae0c899b Add -timestamp switch support to the select command
Fixes #2829
2019-04-01 22:11:18 +11:00
Maxime Coste
4843149b6a Make error description available as "%val{error}" during catch blocks
Fixes #2761
2019-03-05 20:46:23 +11:00
Maxime Coste
370d10ccc7 Always select inserted text after piping
Relying on general selection update code is error prone due to
diffing.

Fixes #2394
2019-01-23 20:14:08 +11:00
Maxime Coste
1875ff51a0 Gather the list of hooks to run before running the parent
This will prevent hooks added by the parent hook manager to be
gathered, as was decided during the discussion for #2603
2018-12-09 10:07:40 +11:00
Maxime Coste
16908bf091 Fix hooks triggering on unset-option even if parent has same value 2018-11-28 21:45:40 +11:00
Maxime Coste
9387abed81 tests: Update selections files to match the new selection list syntax 2018-07-05 07:54:28 +10:00
Frank LENORMAND
58cad9aecf test: Fix UTF8 compliant locale detection 2017-02-23 18:46:56 +03:00
Maxime Coste
13ed87410f Rework compute_modified_ranges
Fixes #743
2016-07-26 23:31:23 +01:00
Maxime Coste
20bd4173e2 Support auto disabling of unit tests with an optional enabled script
Restore the unicode test case using that.
2015-11-16 21:17:23 +00:00
Maxime Coste
c3a4fc9405 Revert "Add an unicode to upper case test", needs an utf8 locale
This reverts commit 6aa892ef49.
2015-11-16 13:56:12 +00:00
Maxime Coste
6aa892ef49 Add an unicode to upper case test 2015-11-15 13:32:48 +00:00
Maxime Coste
e0049bb587 Fix backward search searching from on char before the corret one.
Fixes #406
2015-09-14 14:28:45 +01:00
Maxime Coste
8795a56731 Merge overlapping selections before erasing
Overlapping selections on erase confuse the ForwardChangeTracker
and will confuse the user,

Fixes #298
2015-06-28 10:16:39 +01:00
Maxime Coste
4be6090107 Fix additional eol inserted when replace piping at end of buffer 2015-03-06 13:57:21 +00:00
Maxime Coste
f4e96e7f2e Fix bug when deleting end of buffer text using multiple selections 2015-01-23 19:12:15 +00:00
Alex Leferry 2
d20d43bf36 add testing framework 2014-06-30 12:22:50 +02:00