diff --git a/src/frontend/gui/termwindow.rs b/src/frontend/gui/termwindow.rs index c861a8abd..255b8334f 100644 --- a/src/frontend/gui/termwindow.rs +++ b/src/frontend/gui/termwindow.rs @@ -646,7 +646,7 @@ impl TermWindow { // self.toggle_full_screen(), } Copy => { - // Nominally copy, but that is implicit, so NOP + self.clipboard.set_contents(tab.selection_text())?; } Paste => { tab.trickle_paste(self.clipboard.get_contents()?)?; diff --git a/src/localtab.rs b/src/localtab.rs index 2a70bb50c..e747e548a 100644 --- a/src/localtab.rs +++ b/src/localtab.rs @@ -93,6 +93,11 @@ impl Tab for LocalTab { .selection_range() .map(|r| r.clip_to_viewport(terminal.get_viewport_offset(), rows)) } + + fn selection_text(&self) -> Option { + let terminal = self.terminal.borrow(); + Some(terminal.get_selection_text()) + } } impl LocalTab { diff --git a/src/mux/tab.rs b/src/mux/tab.rs index 1f2bdd404..904b347ac 100644 --- a/src/mux/tab.rs +++ b/src/mux/tab.rs @@ -67,6 +67,7 @@ pub trait Tab: Downcast { /// (eg: it has been normalized and had clip_to_viewport called /// on it prior to being returned) fn selection_range(&self) -> Option; + fn selection_text(&self) -> Option; fn trickle_paste(&self, text: String) -> Fallible<()> { if text.len() <= PASTE_CHUNK_SIZE { diff --git a/src/server/tab.rs b/src/server/tab.rs index 8462b8dac..ab713ce2a 100644 --- a/src/server/tab.rs +++ b/src/server/tab.rs @@ -312,6 +312,11 @@ impl Tab for ClientTab { .lock() .unwrap() } + + fn selection_text(&self) -> Option { + // FIXME: get selection from peer or the surface + None + } } struct RenderableInner { diff --git a/src/termwiztermtab.rs b/src/termwiztermtab.rs index ed2728a62..778f8154d 100644 --- a/src/termwiztermtab.rs +++ b/src/termwiztermtab.rs @@ -294,6 +294,11 @@ impl Tab for TermWizTerminalTab { .lock() .unwrap() } + + fn selection_text(&self) -> Option { + // FIXME: grab it from the surface + None + } } pub struct TermWizTerminal {