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.

Allow outline modal toggling (#37575)

Mitch (a.k.a Voz)1751bf4cdbe8
diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs
index 8c5e78d77bc..1f85d08cee8 100644
--- a/crates/outline/src/outline.rs
+++ b/crates/outline/src/outline.rs
@@ -81,8 +81,19 @@ impl ModalView for OutlineView {
}
impl Render for OutlineView {
- fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
- v_flex().w(rems(34.)).child(self.picker.clone())
+ fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ v_flex()
+ .w(rems(34.))
+ .on_action(cx.listener(
+ |_this: &mut OutlineView,
+ _: &zed_actions::outline::ToggleOutline,
+ _window: &mut Window,
+ cx: &mut Context<OutlineView>| {
+ // When outline::Toggle is triggered while the outline is open, dismiss it
+ cx.emit(DismissEvent);
+ },
+ ))
+ .child(self.picker.clone())
}
}