feat: allow left-click to copy terminal selection text

This commit is contained in:
TomZz
2026-06-25 02:28:26 +08:00
parent 042834c7d5
commit fd19daedad
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -845,6 +845,18 @@ impl Ashell {
}
}
if event.button == MouseButton::Left {
if self.config.right_click_copy_paste() {
if let Some(text) = self.active_terminal_selection_text() {
if !text.is_empty() {
cx.write_to_clipboard(gpui::ClipboardItem::new_string(text));
if let Some(active_id) = &self.active_tab {
if let Some(tab) = self.tabs.iter_mut().find(|tab| &tab.id == active_id) {
tab.clear_selection();
}
}
}
}
}
self.begin_terminal_selection(event, cx);
}
cx.notify();
+1 -1
View File
@@ -182,7 +182,7 @@ impl Ashell {
cx.notify();
}
fn active_terminal_selection_text(&self) -> Option<String> {
pub(crate) fn active_terminal_selection_text(&self) -> Option<String> {
let active_id = self.active_tab.as_ref()?;
self.tabs
.iter()