mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-17 07:49:29 +00:00
Properly deserialize active pane in the workspace (#19744)
Without setting the active pane metadata, no center pane events are emitted on start before the pane is focused manually, which breaks deserialization of other components like outline panel, which should show the active pane's active item outlines on start. Release Notes: - N/A Co-authored-by: Thorsten Ball <thorsten@zed.dev>
This commit is contained in:
parent
6de5ace116
commit
92ba18342c
1 changed files with 9 additions and 6 deletions
|
@ -2947,9 +2947,7 @@ impl Workspace {
|
|||
status_bar.set_active_pane(&pane, cx);
|
||||
});
|
||||
if self.active_pane != pane {
|
||||
self.active_pane = pane.clone();
|
||||
self.active_item_path_changed(cx);
|
||||
self.last_active_center_pane = Some(pane.downgrade());
|
||||
self.set_active_pane(&pane, cx);
|
||||
}
|
||||
|
||||
if self.last_active_center_pane.is_none() {
|
||||
|
@ -2972,6 +2970,12 @@ impl Workspace {
|
|||
cx.notify();
|
||||
}
|
||||
|
||||
fn set_active_pane(&mut self, pane: &View<Pane>, cx: &mut ViewContext<Self>) {
|
||||
self.active_pane = pane.clone();
|
||||
self.active_item_path_changed(cx);
|
||||
self.last_active_center_pane = Some(pane.downgrade());
|
||||
}
|
||||
|
||||
fn handle_panel_focused(&mut self, cx: &mut ViewContext<Self>) {
|
||||
self.update_active_view_for_followers(cx);
|
||||
}
|
||||
|
@ -4263,12 +4267,11 @@ impl Workspace {
|
|||
|
||||
// Swap workspace center group
|
||||
workspace.center = PaneGroup::with_root(center_group);
|
||||
workspace.last_active_center_pane = active_pane.as_ref().map(|p| p.downgrade());
|
||||
if let Some(active_pane) = active_pane {
|
||||
workspace.active_pane = active_pane;
|
||||
workspace.set_active_pane(&active_pane, cx);
|
||||
cx.focus_self();
|
||||
} else {
|
||||
workspace.active_pane = workspace.center.first_pane().clone();
|
||||
workspace.set_active_pane(&workspace.center.first_pane(), cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue