|
|
@ -2735,7 +2735,9 @@ fn delete_selection_impl(cx: &mut Context, op: Operation, yank: YankAction) {
|
|
|
|
// yank the selection
|
|
|
|
// yank the selection
|
|
|
|
let text = doc.text().slice(..);
|
|
|
|
let text = doc.text().slice(..);
|
|
|
|
let values: Vec<String> = selection.fragments(text).map(Cow::into_owned).collect();
|
|
|
|
let values: Vec<String> = selection.fragments(text).map(Cow::into_owned).collect();
|
|
|
|
let reg_name = cx.register.unwrap_or('"');
|
|
|
|
let reg_name = cx
|
|
|
|
|
|
|
|
.register
|
|
|
|
|
|
|
|
.unwrap_or_else(|| cx.editor.config.load().default_yank_register);
|
|
|
|
if let Err(err) = cx.editor.registers.write(reg_name, values) {
|
|
|
|
if let Err(err) = cx.editor.registers.write(reg_name, values) {
|
|
|
|
cx.editor.set_error(err.to_string());
|
|
|
|
cx.editor.set_error(err.to_string());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -4221,7 +4223,11 @@ fn commit_undo_checkpoint(cx: &mut Context) {
|
|
|
|
// Yank / Paste
|
|
|
|
// Yank / Paste
|
|
|
|
|
|
|
|
|
|
|
|
fn yank(cx: &mut Context) {
|
|
|
|
fn yank(cx: &mut Context) {
|
|
|
|
yank_impl(cx.editor, cx.register.unwrap_or('"'));
|
|
|
|
yank_impl(
|
|
|
|
|
|
|
|
cx.editor,
|
|
|
|
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
|
|
|
|
);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4282,7 +4288,12 @@ fn yank_joined_impl(editor: &mut Editor, separator: &str, register: char) {
|
|
|
|
|
|
|
|
|
|
|
|
fn yank_joined(cx: &mut Context) {
|
|
|
|
fn yank_joined(cx: &mut Context) {
|
|
|
|
let separator = doc!(cx.editor).line_ending.as_str();
|
|
|
|
let separator = doc!(cx.editor).line_ending.as_str();
|
|
|
|
yank_joined_impl(cx.editor, separator, cx.register.unwrap_or('"'));
|
|
|
|
yank_joined_impl(
|
|
|
|
|
|
|
|
cx.editor,
|
|
|
|
|
|
|
|
separator,
|
|
|
|
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
|
|
|
|
);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4442,7 +4453,12 @@ fn paste_primary_clipboard_before(cx: &mut Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn replace_with_yanked(cx: &mut Context) {
|
|
|
|
fn replace_with_yanked(cx: &mut Context) {
|
|
|
|
replace_with_yanked_impl(cx.editor, cx.register.unwrap_or('"'), cx.count());
|
|
|
|
replace_with_yanked_impl(
|
|
|
|
|
|
|
|
cx.editor,
|
|
|
|
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
|
|
|
|
cx.count(),
|
|
|
|
|
|
|
|
);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
exit_select_mode(cx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4505,7 +4521,8 @@ fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
|
|
|
|
fn paste_after(cx: &mut Context) {
|
|
|
|
fn paste_after(cx: &mut Context) {
|
|
|
|
paste(
|
|
|
|
paste(
|
|
|
|
cx.editor,
|
|
|
|
cx.editor,
|
|
|
|
cx.register.unwrap_or('"'),
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
Paste::After,
|
|
|
|
Paste::After,
|
|
|
|
cx.count(),
|
|
|
|
cx.count(),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -4515,7 +4532,8 @@ fn paste_after(cx: &mut Context) {
|
|
|
|
fn paste_before(cx: &mut Context) {
|
|
|
|
fn paste_before(cx: &mut Context) {
|
|
|
|
paste(
|
|
|
|
paste(
|
|
|
|
cx.editor,
|
|
|
|
cx.editor,
|
|
|
|
cx.register.unwrap_or('"'),
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
Paste::Before,
|
|
|
|
Paste::Before,
|
|
|
|
cx.count(),
|
|
|
|
cx.count(),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -5369,7 +5387,8 @@ fn insert_register(cx: &mut Context) {
|
|
|
|
cx.register = Some(ch);
|
|
|
|
cx.register = Some(ch);
|
|
|
|
paste(
|
|
|
|
paste(
|
|
|
|
cx.editor,
|
|
|
|
cx.editor,
|
|
|
|
cx.register.unwrap_or('"'),
|
|
|
|
cx.register
|
|
|
|
|
|
|
|
.unwrap_or(cx.editor.config().default_yank_register),
|
|
|
|
Paste::Cursor,
|
|
|
|
Paste::Cursor,
|
|
|
|
cx.count(),
|
|
|
|
cx.count(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|