Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 24546908..e36c694f 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -4659,7 +4659,7 @@ fn yank_joined_to_primary_clipboard(cx: &mut Context) {
exit_select_mode(cx);
}
-fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
+pub(crate) fn yank_main_selection_to_register(editor: &mut Editor, register: char) {
let (view, doc) = current!(editor);
let text = doc.text().slice(..);
@@ -4672,17 +4672,17 @@ fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
}
fn yank_main_selection_to_clipboard(cx: &mut Context) {
- yank_primary_selection_impl(cx.editor, '+');
+ yank_main_selection_to_register(cx.editor, '+');
exit_select_mode(cx);
}
fn yank_main_selection_to_primary_clipboard(cx: &mut Context) {
- yank_primary_selection_impl(cx.editor, '*');
+ yank_main_selection_to_register(cx.editor, '*');
exit_select_mode(cx);
}
#[derive(Copy, Clone)]
-enum Paste {
+pub(crate) enum Paste {
Before,
After,
Cursor,
@@ -4805,16 +4805,15 @@ fn paste_primary_clipboard_before(cx: &mut Context) {
}
fn replace_with_yanked(cx: &mut Context) {
- replace_with_yanked_impl(
+ replace_selections_with_register(
cx.editor,
- cx.register
- .unwrap_or(cx.editor.config().default_yank_register),
+ cx.editor.config().default_yank_register,
cx.count(),
);
exit_select_mode(cx);
}
-fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
+pub(crate) fn replace_selections_with_register(editor: &mut Editor, register: char, count: usize) {
let Some(values) = editor
.registers
.read(register, editor)
@@ -4858,16 +4857,16 @@ fn replace_with_yanked_impl(editor: &mut Editor, register: char, count: usize) {
}
fn replace_selections_with_clipboard(cx: &mut Context) {
- replace_with_yanked_impl(cx.editor, '+', cx.count());
+ replace_selections_with_register(cx.editor, '+', cx.count());
exit_select_mode(cx);
}
fn replace_selections_with_primary_clipboard(cx: &mut Context) {
- replace_with_yanked_impl(cx.editor, '*', cx.count());
+ replace_selections_with_register(cx.editor, '*', cx.count());
exit_select_mode(cx);
}
-fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
+pub(crate) fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
let Some(values) = editor.registers.read(register, editor) else {
return;
};