From eaa0e93112b1174ac5bf07a51619b9bcdf9c3db3 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Fri, 19 Jan 2024 14:52:49 -0800 Subject: [PATCH 1/2] Fix hover popovers showing up over zoomed panels --- crates/editor/src/element.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 1c4fafb26898ec0ed05ed1ef9f5e98ce8b3fe3bd..aed6c55668a1143d1076e950bae4b328a3aca786 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1218,9 +1218,11 @@ impl EditorElement { popover_origin.x = popover_origin.x + x_out_of_bounds; } - cx.break_content_mask(|cx| { - hover_popover.draw(popover_origin, available_space, cx) - }); + if cx.was_top_layer(&popover_origin, cx.stacking_order()) { + cx.break_content_mask(|cx| { + hover_popover.draw(popover_origin, available_space, cx) + }); + } current_y = popover_origin.y - HOVER_POPOVER_GAP; } From 25f78a2ed14b8fbb9e3ddfaa6d1327dcdc43d3c7 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Fri, 19 Jan 2024 15:02:10 -0800 Subject: [PATCH 2/2] Fix terminal selection firing when dragging anywhere --- crates/terminal/src/terminal.rs | 4 ++++ crates/terminal_view/src/terminal_element.rs | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 502706eb5b30bebe35507e1a9fddeb951d674c53..d9bdc17744810a59cb1c7b3303b1ddefc19e59ca 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -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 fn update_process_info(&mut self) -> bool { let mut pid = unsafe { libc::tcgetpgrp(self.shell_fd as i32) }; diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index 78235c3579624d510d47c64fd854ab46b82c8b96..29944b54d7729d7cf257c515339234db9f666751 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -621,9 +621,17 @@ impl TerminalElement { } 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.mouse_drag(e, origin, bounds); - cx.notify(); + if !terminal.selection_started() { + if visibly_contains { + terminal.mouse_drag(e, origin, bounds); + cx.notify(); + } + } else { + terminal.mouse_drag(e, origin, bounds); + cx.notify(); + } }) }