From baceb02a090fe711ad772d855635bc590826fa53 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 10 Jul 2023 18:48:29 -0500 Subject: 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. --- helix-view/src/info.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'helix-view/src/info.rs') 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); -- cgit v1.2.3-70-g09d2