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.

debugger: Save debug session layout when changing focus or closing session (#28788)

Anthony Eidf1f5d602fcfa
diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs
index 9cec74d27e1..336783212f1 100644
--- a/crates/debugger_ui/src/debugger_panel.rs
+++ b/crates/debugger_ui/src/debugger_panel.rs
@@ -438,7 +438,13 @@ impl DebugPanel {
else {
return;
};
-
+ session.update(cx, |this, cx| {
+ if let Some(running) = this.mode().as_running() {
+ running.update(cx, |this, cx| {
+ this.serialize_layout(window, cx);
+ });
+ }
+ });
let session_id = session.update(cx, |this, cx| this.session_id(cx));
let should_prompt = self
.project
diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs
index d948ba30091..80ce42d2d60 100644
--- a/crates/debugger_ui/src/session/running.rs
+++ b/crates/debugger_ui/src/session/running.rs
@@ -421,6 +421,9 @@ impl RunningState {
}
cx.notify()
}),
+ cx.on_focus_out(&focus_handle, window, |this, _, window, cx| {
+ this.serialize_layout(window, cx);
+ }),
];
let mut pane_close_subscriptions = HashMap::default();
@@ -476,7 +479,7 @@ impl RunningState {
}
}
- fn serialize_layout(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ pub(crate) fn serialize_layout(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self._schedule_serialize.is_none() {
self._schedule_serialize = Some(cx.spawn_in(window, async move |this, cx| {
cx.background_executor()