diff --git a/src/session/mod.rs b/src/session/mod.rs index 87d058f..4b8f0c8 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -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(); diff --git a/src/terminal/input.rs b/src/terminal/input.rs index 549dd1a..f9c68ca 100644 --- a/src/terminal/input.rs +++ b/src/terminal/input.rs @@ -182,7 +182,7 @@ impl Ashell { cx.notify(); } - fn active_terminal_selection_text(&self) -> Option { + pub(crate) fn active_terminal_selection_text(&self) -> Option { let active_id = self.active_tab.as_ref()?; self.tabs .iter()