diff options
author | Michael Davis | 2023-07-10 23:48:29 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-07-31 06:05:38 +0000 |
commit | baceb02a090fe711ad772d855635bc590826fa53 (patch) | |
tree | 9bb4eecbce2e7c84caf707f33ff39d7a2dcf7102 /helix-view/src/info.rs | |
parent | 0f19f282cfa49d441f58a8e2540a6b24efe1b769 (diff) |
Use refactored Registers type
This is an unfortunately noisy change: we need to update virtually all
callsites that access the registers. For reads this means passing in the
Editor and for writes this means handling potential failure when we
can't write to a clipboard register.
Diffstat (limited to 'helix-view/src/info.rs')
-rw-r--r-- | helix-view/src/info.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/helix-view/src/info.rs b/helix-view/src/info.rs index 1503e855..ca783fef 100644 --- a/helix-view/src/info.rs +++ b/helix-view/src/info.rs @@ -1,4 +1,5 @@ -use helix_core::{register::Registers, unicode::width::UnicodeWidthStr}; +use crate::register::Registers; +use helix_core::unicode::width::UnicodeWidthStr; use std::fmt::Write; #[derive(Debug)] @@ -56,16 +57,8 @@ impl Info { pub fn from_registers(registers: &Registers) -> Self { let body: Vec<_> = registers - .inner() - .iter() - .map(|(ch, reg)| { - let content = reg - .read() - .get(0) - .and_then(|s| s.lines().next()) - .unwrap_or_default(); - (ch.to_string(), content) - }) + .iter_preview() + .map(|(ch, preview)| (ch.to_string(), preview)) .collect(); let mut infobox = Self::new("Registers", &body); |