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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user