Skip to content

Commit

Permalink
Changed Selection Yank Message (helix-editor#4275)
Browse files Browse the repository at this point in the history
Co-authored-by: Nathaniel Graham <ngraham@protonmail.com>
  • Loading branch information
2 people authored and pathwave committed Oct 16, 2022
1 parent ab7735c commit bac8b89
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3508,9 +3508,15 @@ fn yank_joined_to_clipboard_impl(
.map(Cow::into_owned)
.collect();

let clipboard_text = match clipboard_type {
ClipboardType::Clipboard => "system clipboard",
ClipboardType::Selection => "primary clipboard",
};

let msg = format!(
"joined and yanked {} selection(s) to system clipboard",
"joined and yanked {} selection(s) to {}",
values.len(),
clipboard_text,
);

let joined = values.join(separator);
Expand Down Expand Up @@ -3539,6 +3545,11 @@ fn yank_main_selection_to_clipboard_impl(
let (view, doc) = current!(editor);
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);

if let Err(e) = editor
Expand All @@ -3548,7 +3559,7 @@ fn yank_main_selection_to_clipboard_impl(
bail!("Couldn't set system clipboard content: {}", e);
}

editor.set_status("yanked main selection to system clipboard");
editor.set_status(message_text);
Ok(())
}

Expand Down

0 comments on commit bac8b89

Please sign in to comment.