From ce5270488f60aa7333dfa8dddef4d4b5efb70066 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sun, 30 Jan 2022 16:01:13 +0100 Subject: [PATCH] Propagate `Cancel` when editor is not in full mode This is consistent with what VS Code and Sublime Text do and allows the user to perform only one keybinding to e.g. dismiss the find bar when the query is (partially) selected. --- crates/editor/src/editor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0ee4f3191e8bf0f820fddd4f36fe616cc6fb16eb..db0c099c4b8e228eea8c2349e945770c836bda82 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1091,6 +1091,11 @@ impl Editor { } pub fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext) { + if self.mode != EditorMode::Full { + cx.propagate_action(); + return; + } + if self.active_diagnostics.is_some() { self.dismiss_diagnostics(cx); } else if let Some(PendingSelection { selection, .. }) = self.pending_selection.take() {