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.

collab panel: Unfocus filter editor on escape (#16579)

Thorsten Ball28568429aa26
diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs
index 0ff1131e679..dfef40efbcc 100644
--- a/crates/collab_ui/src/collab_panel.rs
+++ b/crates/collab_ui/src/collab_panel.rs
@@ -1395,15 +1395,22 @@ impl CollabPanel {
cx.notify();
}
+ fn reset_filter_editor_text(&mut self, cx: &mut ViewContext<Self>) -> bool {
+ self.filter_editor.update(cx, |editor, cx| {
+ if editor.buffer().read(cx).len(cx) > 0 {
+ editor.set_text("", cx);
+ true
+ } else {
+ false
+ }
+ })
+ }
+
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
if self.take_editing_state(cx) {
cx.focus_view(&self.filter_editor);
- } else {
- self.filter_editor.update(cx, |editor, cx| {
- if editor.buffer().read(cx).len(cx) > 0 {
- editor.set_text("", cx);
- }
- });
+ } else if !self.reset_filter_editor_text(cx) {
+ self.focus_handle.focus(cx);
}
if self.context_menu.is_some() {