Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Ensure all menus and popups are dismissed (#43169)

Dino5ef6402d645b
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 9401d5a1e2f..5d1c24bcad7 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -4122,44 +4122,23 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) -> bool {
- if self.take_rename(false, window, cx).is_some() {
- return true;
- }
-
- if self.hide_blame_popover(true, cx) {
- return true;
- }
-
- if hide_hover(self, cx) {
- return true;
- }
-
- if self.hide_signature_help(cx, SignatureHelpHiddenBy::Escape) {
- return true;
- }
-
- if self.hide_context_menu(window, cx).is_some() {
- return true;
- }
-
- if self.mouse_context_menu.take().is_some() {
- return true;
- }
-
- if is_user_requested && self.discard_edit_prediction(true, cx) {
- return true;
- }
+ let mut dismissed = false;
- if self.snippet_stack.pop().is_some() {
- return true;
- }
+ dismissed |= self.take_rename(false, window, cx).is_some();
+ dismissed |= self.hide_blame_popover(true, cx);
+ dismissed |= hide_hover(self, cx);
+ dismissed |= self.hide_signature_help(cx, SignatureHelpHiddenBy::Escape);
+ dismissed |= self.hide_context_menu(window, cx).is_some();
+ dismissed |= self.mouse_context_menu.take().is_some();
+ dismissed |= is_user_requested && self.discard_edit_prediction(true, cx);
+ dismissed |= self.snippet_stack.pop().is_some();
if self.mode.is_full() && matches!(self.active_diagnostics, ActiveDiagnostic::Group(_)) {
self.dismiss_diagnostics(cx);
- return true;
+ dismissed = true;
}
- false
+ dismissed
}
fn linked_editing_ranges_for(