helix/helix-view/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
..
handlers Fix unwrap bug in DAP (#6786) 2023-04-17 15:36:04 -05:00
base64.rs Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
clipboard.rs Fix warnings from clippy (#7013) 2023-05-11 14:44:52 +09:00
document.rs Prefer RopeSlice to &Rope in helix_core::syntax 2023-07-27 11:50:19 +09:00
editor.rs Use refactored Registers type 2023-07-31 15:05:38 +09:00
env.rs Use OSC 52 as a fallback for setting the system clipboard (#3220) 2022-11-02 10:12:40 +09:00
graphics.rs build(deps): bump bitflags from 1.3.2 to 2.0.2 (#6387) 2023-03-22 08:12:08 +08:00
gutter.rs Apply all review suggestions (doc_id -> id, error message, unnecessary if) 2023-05-18 22:04:49 +02:00
info.rs Use refactored Registers type 2023-07-31 15:05:38 +09:00
input.rs allow for higher F keys to be used (#7672) 2023-07-19 11:05:32 +09:00
keyboard.rs build(deps): bump bitflags from 1.3.2 to 2.0.2 (#6387) 2023-03-22 08:12:08 +08:00
lib.rs Refactor Registers to take Editor 2023-07-31 15:05:38 +09:00
macros.rs Apply transactions to all views (#4733) 2022-11-23 12:28:49 +09:00
register.rs Preview the latest value for regular registers 2023-07-31 15:05:38 +09:00
theme.rs Allow ANSI colors in themes (#5119) 2023-06-19 11:02:34 +09:00
tree.rs Fix warnings from clippy (#7013) 2023-05-11 14:44:52 +09:00
view.rs fix view anchors not at start of a visual line 2023-03-27 09:54:40 +09:00