Changed Selection Yank Message (#4275)

Co-authored-by: Nathaniel Graham <ngraham@protonmail.com>
pull/4277/head
Nathaniel Graham 2 years ago committed by GitHub
parent 2d958d6c50
commit e80beaa7b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3345,9 +3345,15 @@ fn yank_joined_to_clipboard_impl(
.map(Cow::into_owned) .map(Cow::into_owned)
.collect(); .collect();
let clipboard_text = match clipboard_type {
ClipboardType::Clipboard => "system clipboard",
ClipboardType::Selection => "primary clipboard",
};
let msg = format!( let msg = format!(
"joined and yanked {} selection(s) to system clipboard", "joined and yanked {} selection(s) to {}",
values.len(), values.len(),
clipboard_text,
); );
let joined = values.join(separator); let joined = values.join(separator);
@ -3376,6 +3382,11 @@ fn yank_main_selection_to_clipboard_impl(
let (view, doc) = current!(editor); let (view, doc) = current!(editor);
let text = doc.text().slice(..); let text = doc.text().slice(..);
let message_text = match clipboard_type {
ClipboardType::Clipboard => "yanked main selection to system clipboard",
ClipboardType::Selection => "yanked main selection to primary clipboard",
};
let value = doc.selection(view.id).primary().fragment(text); let value = doc.selection(view.id).primary().fragment(text);
if let Err(e) = editor if let Err(e) = editor
@ -3385,7 +3396,7 @@ fn yank_main_selection_to_clipboard_impl(
bail!("Couldn't set system clipboard content: {}", e); bail!("Couldn't set system clipboard content: {}", e);
} }
editor.set_status("yanked main selection to system clipboard"); editor.set_status(message_text);
Ok(()) Ok(())
} }

Loading…
Cancel
Save