Fix terminal selection firing when dragging anywhere
This commit is contained in:
parent
eaa0e93112
commit
25f78a2ed1
2 changed files with 14 additions and 2 deletions
|
@ -599,6 +599,10 @@ impl Terminal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn selection_started(&self) -> bool {
|
||||||
|
self.selection_phase == SelectionPhase::Selecting
|
||||||
|
}
|
||||||
|
|
||||||
/// Updates the cached process info, returns whether the Zed-relevant info has changed
|
/// Updates the cached process info, returns whether the Zed-relevant info has changed
|
||||||
fn update_process_info(&mut self) -> bool {
|
fn update_process_info(&mut self) -> bool {
|
||||||
let mut pid = unsafe { libc::tcgetpgrp(self.shell_fd as i32) };
|
let mut pid = unsafe { libc::tcgetpgrp(self.shell_fd as i32) };
|
||||||
|
|
|
@ -621,9 +621,17 @@ impl TerminalElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.pressed_button.is_some() && !cx.has_active_drag() {
|
if e.pressed_button.is_some() && !cx.has_active_drag() {
|
||||||
|
let visibly_contains = interactive_bounds.visibly_contains(&e.position, cx);
|
||||||
terminal.update(cx, |terminal, cx| {
|
terminal.update(cx, |terminal, cx| {
|
||||||
terminal.mouse_drag(e, origin, bounds);
|
if !terminal.selection_started() {
|
||||||
cx.notify();
|
if visibly_contains {
|
||||||
|
terminal.mouse_drag(e, origin, bounds);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
terminal.mouse_drag(e, origin, bounds);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue