From 4555a6b4332b48384d4bccfef527d26060c34037 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 11 Jul 2023 10:23:49 -0500 Subject: Reimplement clipboard commands in terms of special regs Since the clipboard provider now lives on the Registers type, we want to eliminate it from the Editor. We can do that and clean up the commands that interact with the clipboard by calling regular yank, paste and replace impls on the clipboard special registers. Eventually the clipboard commands could be removed once macro keybinding is supported. --- helix-view/src/editor.rs | 4 ---- helix-view/src/register.rs | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 1824ebf7..4ea1c49f 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1,6 +1,5 @@ use crate::{ align_view, - clipboard::{get_clipboard_provider, ClipboardProvider}, document::{DocumentSavedEventFuture, DocumentSavedEventResult, Mode, SavePoint}, graphics::{CursorKind, Rect}, info::Info, @@ -875,8 +874,6 @@ pub struct Editor { pub debugger_events: SelectAll>, pub breakpoints: HashMap>, - pub clipboard_provider: Box, - pub syn_loader: Arc, pub theme_loader: Arc, /// last_theme is used for theme previews. We store the current theme here, @@ -1023,7 +1020,6 @@ impl Editor { last_theme: None, last_selection: None, registers: Registers::default(), - clipboard_provider: get_clipboard_provider(), status_msg: None, autoinfo: None, idle_timer: Box::pin(sleep(conf.idle_timeout)), diff --git a/helix-view/src/register.rs b/helix-view/src/register.rs index 61912378..3d1849a6 100644 --- a/helix-view/src/register.rs +++ b/helix-view/src/register.rs @@ -215,6 +215,10 @@ impl Registers { ) } } + + pub fn clipboard_provider_name(&self) -> Cow { + self.clipboard_provider.name() + } } fn read_from_clipboard<'a>( -- cgit v1.2.3-70-g09d2