Clear selection on Ctrl+C, part of #236
This commit is contained in:
parent
fe21878169
commit
91f252c882
1 changed files with 8 additions and 2 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -1823,9 +1823,15 @@ impl Application for App {
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
let entity = entity_opt.unwrap_or_else(|| tab_model.active());
|
let entity = entity_opt.unwrap_or_else(|| tab_model.active());
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
let term = terminal.term.lock();
|
let mut term = terminal.term.lock();
|
||||||
if let Some(text) = term.selection_to_string() {
|
if let Some(text) = term.selection_to_string() {
|
||||||
|
// Clear selection (to allow next Ctrl+C to signal)
|
||||||
|
term.selection = None;
|
||||||
|
drop(term);
|
||||||
|
// Mark as dirty
|
||||||
|
terminal.needs_update = true;
|
||||||
|
drop(terminal);
|
||||||
return Task::batch([clipboard::write(text), self.update_focus()]);
|
return Task::batch([clipboard::write(text), self.update_focus()]);
|
||||||
} else {
|
} else {
|
||||||
// Drop the lock for term so that input_scroll doesn't block forever
|
// Drop the lock for term so that input_scroll doesn't block forever
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue