Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git_ui: Fix tooltip overlaying context menu in git blame (#42764)
Mustaque Ahmed00e6cbc4fc15
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex f70693a8d67..2df5a5d3836 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -6920,7 +6920,11 @@ impl Editor {}}- fn hide_blame_popover(&mut self, ignore_timeout: bool, cx: &mut Context<Self>) -> bool {+ pub fn has_mouse_context_menu(&self) -> bool {+ self.mouse_context_menu.is_some()+ }++ pub fn hide_blame_popover(&mut self, ignore_timeout: bool, cx: &mut Context<Self>) -> bool {self.inline_blame_popover_show_task.take();if let Some(state) = &mut self.inline_blame_popover {let hide_task = cx.spawn(async move |editor, cx| {diff --git a/crates/git_ui/src/blame_ui.rs b/crates/git_ui/src/blame_ui.rsindex c904c4b3b7c..fe9af196021 100644--- a/crates/git_ui/src/blame_ui.rs+++ b/crates/git_ui/src/blame_ui.rs@@ -55,6 +55,7 @@ impl BlameRenderer for GitBlameRenderer {} else {None};+Some(div().mr_2()@@ -80,7 +81,10 @@ impl BlameRenderer for GitBlameRenderer {.on_mouse_down(MouseButton::Right, {let blame_entry = blame_entry.clone();let details = details.clone();+ let editor = editor.clone();move |event, window, cx| {+ cx.stop_propagation();+deploy_blame_entry_context_menu(&blame_entry,details.as_ref(),@@ -107,17 +111,19 @@ impl BlameRenderer for GitBlameRenderer {)}})- .hoverable_tooltip(move |_window, cx| {- cx.new(|cx| {- CommitTooltip::blame_entry(- &blame_entry,- details.clone(),- repository.clone(),- workspace.clone(),- cx,- )+ .when(!editor.read(cx).has_mouse_context_menu(), |el| {+ el.hoverable_tooltip(move |_window, cx| {+ cx.new(|cx| {+ CommitTooltip::blame_entry(+ &blame_entry,+ details.clone(),+ repository.clone(),+ workspace.clone(),+ cx,+ )+ })+ .into()})- .into()}),).into_any(),@@ -396,6 +402,7 @@ fn deploy_blame_entry_context_menu(});editor.update(cx, move |editor, cx| {+ editor.hide_blame_popover(false, cx);editor.deploy_mouse_context_menu(position, context_menu, window, cx);cx.notify();});