aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorMichael Davis2023-07-10 23:48:29 +0000
committerBlaž Hrastnik2023-07-31 06:05:38 +0000
commitbaceb02a090fe711ad772d855635bc590826fa53 (patch)
tree9bb4eecbce2e7c84caf707f33ff39d7a2dcf7102 /helix-view
parent0f19f282cfa49d441f58a8e2540a6b24efe1b769 (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')
-rw-r--r--helix-view/src/editor.rs2
-rw-r--r--helix-view/src/info.rs15
2 files changed, 5 insertions, 12 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 20469ae9..1824ebf7 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -5,6 +5,7 @@ use crate::{
graphics::{CursorKind, Rect},
info::Info,
input::KeyEvent,
+ register::Registers,
theme::{self, Theme},
tree::{self, Tree},
view::ViewPosition,
@@ -40,7 +41,6 @@ use tokio::{
use anyhow::{anyhow, bail, Error};
pub use helix_core::diagnostic::Severity;
-pub use helix_core::register::Registers;
use helix_core::{
auto_pairs::AutoPairs,
syntax::{self, AutoPairConfig, SoftWrap},
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);