Allow outline modal toggling (#37575)

Closes #37511 

The outline modal seems to have a bug where if it's open and the
`outline::Toggle` is triggered, it would not close if there was another
command with the same keybind. So instead, if the outline modal is open
and an `outline::Toggle` is triggered, we dismiss the modal.

Release Notes:

- Fixed a bug where `outline::Toggle` would sometimes not close outline
modal
This commit is contained in:
Mitch (a.k.a Voz)
2025-09-09 13:26:35 -06:00
committed by GitHub
parent 2fae4c7c72
commit 1751bf4cdb
+13 -2
View File
@@ -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())
}
}