implement explicit Copy keybinding action

previously we would only ever copy to the clipboard when the selection
was changed.

Now we respect the Copy keypress and have it re-copy the selection
into the clipboard.
This commit is contained in:
Wez Furlong committed 2019-11-11 08:54:47 -08:00
1 parent a83851dcca
commit 5370e88520
5 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -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()?)?;
+5
View File
@@ -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<String> {
let terminal = self.terminal.borrow();
Some(terminal.get_selection_text())
}
}
impl LocalTab {
+1
View File
@@ -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<SelectionRange>;
fn selection_text(&self) -> Option<String>;
fn trickle_paste(&self, text: String) -> Fallible<()> {
if text.len() <= PASTE_CHUNK_SIZE {
+5
View File
@@ -312,6 +312,11 @@ impl Tab for ClientTab {
.lock()
.unwrap()
}
fn selection_text(&self) -> Option<String> {
// FIXME: get selection from peer or the surface
None
}
}
struct RenderableInner {
+5
View File
@@ -294,6 +294,11 @@ impl Tab for TermWizTerminalTab {
.lock()
.unwrap()
}
fn selection_text(&self) -> Option<String> {
// FIXME: grab it from the surface
None
}
}
pub struct TermWizTerminal {