Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Selection Yank Message #4275

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3339,9 +3339,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 @@ -3370,6 +3376,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 @@ -3379,7 +3390,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