helix-mirror/helix-term/src
Michael Davis 2d838d729c Preview the latest value for regular registers
This fixes a discrepancy between regular registers which are used for
yanking multiple values (for example via `"ay`) and regular registers
that store a history of values (for example `"a*`).

Previously, the preview shown in `select_register`'s infobox would show
the oldest value in history. It's intuitive and useful to see the most
recent value pushed to the history though.

We cannot simply switch the preview line from `values.first()`
to `values.last()`: that would fix the preview for registers
used for history but break the preview for registers used to yank
multiple values. We could push to the beginning of the values with
`Registers::push` but this is wasteful from a performance perspective.
Instead we can have `Registers::read` return an iterator that
returns elements in the reverse order and reverse the values in
`Register::write`. This effectively means that `push` adds elements to
the beginning of the register's values. For the sake of the preview, we
can switch to `values.last()` and that is then correct for both usage-
styles. This also needs a change to call-sites that read the latest
history value to switch from `last` to `first`.
2023-07-31 15:05:38 +09:00
..
commands Use refactored Registers type 2023-07-31 15:05:38 +09:00
keymap Remove Keymap(KeyTrie) and simply use KeyTrie. 2023-06-07 10:11:13 +09:00
ui Preview the latest value for regular registers 2023-07-31 15:05:38 +09:00
application.rs Add support for LSP DidChangeWatchedFiles (#7665) 2023-07-22 00:21:21 +02:00
args.rs Fix confusion with using --hsplit --vsplit on startup at same time (#4202) 2022-10-11 09:25:42 -04:00
commands.rs Preview the latest value for regular registers 2023-07-31 15:05:38 +09:00
compositor.rs bump msrv to 1.63 (#5570) 2023-02-09 11:24:31 +09:00
config.rs Remove Keymap(KeyTrie) and simply use KeyTrie. 2023-06-07 10:11:13 +09:00
health.rs Refactor doc language servers to a HashMap, and the config to use a Vec to retain order 2023-05-18 21:48:32 +02:00
job.rs bump msrv to 1.63 (#5570) 2023-02-09 11:24:31 +09:00
keymap.rs Remove Keymap(KeyTrie) and simply use KeyTrie. 2023-06-07 10:11:13 +09:00
lib.rs Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
main.rs Initialize log and config files right after parsing arguments (#7585) 2023-07-09 11:30:43 -05:00