helix/helix-term
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
..
src Preview the latest value for regular registers 2023-07-31 15:05:38 +09:00
tests Add config for default line ending (#5621) 2023-06-16 12:02:15 -05:00
.gitignore Initial import. 2020-05-20 18:14:51 +09:00
build.rs feat(lsp): pass client_info on initialization (#4904) 2022-12-08 21:57:03 -06:00
Cargo.toml build(deps): bump tempfile from 3.6.0 to 3.7.0 (#7726) 2023-07-25 03:03:03 +02:00