editor: Hide the git blame popover on escape (#40549)

Release Notes:

- Added way to hide git blame popover by pressing the escape key.
This commit is contained in:
Tim Vermeulen
2025-10-21 20:34:13 +05:30
committed by GitHub
parent 854d1ec4dc
commit 981fa288eb
2 changed files with 15 additions and 6 deletions
+13 -4
View File
@@ -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
}
}
+2 -2
View File
@@ -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 {