Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Hide the git blame popover on escape (#40549)
Tim Vermeulen981fa288eb43
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 7955aac5e52..1a8c8600bf5 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -3990,6 +3990,10 @@ impl Editor {return true;}+ if self.hide_blame_popover(true, cx) {+ return true;+ }+if hide_hover(self, cx) {return true;}@@ -6839,13 +6843,15 @@ impl Editor {}}- fn hide_blame_popover(&mut self, cx: &mut Context<Self>) {+ 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| {- cx.background_executor()- .timer(std::time::Duration::from_millis(100))- .await;+ if !ignore_timeout {+ cx.background_executor()+ .timer(std::time::Duration::from_millis(100))+ .await;+ }editor.update(cx, |editor, cx| {editor.inline_blame_popover.take();@@ -6854,6 +6860,9 @@ impl Editor {.ok();});state.hide_task = Some(hide_task);+ true+ } else {+ false}}diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 65c9d1dbc78..c726de49475 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -1207,10 +1207,10 @@ impl EditorElement {if mouse_over_inline_blame || mouse_over_popover {editor.show_blame_popover(*buffer_id, blame_entry, event.position, false, cx);} else if !keyboard_grace {- editor.hide_blame_popover(cx);+ editor.hide_blame_popover(false, cx);}} else {- editor.hide_blame_popover(cx);+ editor.hide_blame_popover(false, cx);}let breakpoint_indicator = if gutter_hovered {