aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorMichael Davis2023-07-11 15:23:49 +0000
committerBlaž Hrastnik2023-07-31 06:05:38 +0000
commit4555a6b4332b48384d4bccfef527d26060c34037 (patch)
treebaab80c83c6e4abe9bf9035794045d6ba575bb1f /helix-view
parent2d838d729cca26a718e3536e8d75c60396420dbd (diff)
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.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs4
-rw-r--r--helix-view/src/register.rs4
2 files changed, 4 insertions, 4 deletions
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<UnboundedReceiverStream<dap::Payload>>,
pub breakpoints: HashMap<PathBuf, Vec<Breakpoint>>,
- pub clipboard_provider: Box<dyn ClipboardProvider>,
-
pub syn_loader: Arc<syntax::Loader>,
pub theme_loader: Arc<theme::Loader>,
/// 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<str> {
+ self.clipboard_provider.name()
+ }
}
fn read_from_clipboard<'a>(