workspace: Persist centered layout across project switches (#32299)
Closes #32297 Changes: - Added restoration of `workspace.centered_layout` from `serialized.centered_layout` - Ensures the centered layout state persists across project switches Release Notes: - Fixed centered layout not persisting when switching between projects
This commit is contained in:
parent
1a321b51df
commit
106b98fbcb
1 changed files with 15 additions and 2 deletions
|
@ -1399,15 +1399,23 @@ impl Workspace {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
let window = if let Some(window) = requesting_window {
|
let window = if let Some(window) = requesting_window {
|
||||||
|
let centered_layout = serialized_workspace
|
||||||
|
.as_ref()
|
||||||
|
.map(|w| w.centered_layout)
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
cx.update_window(window.into(), |_, window, cx| {
|
cx.update_window(window.into(), |_, window, cx| {
|
||||||
window.replace_root(cx, |window, cx| {
|
window.replace_root(cx, |window, cx| {
|
||||||
Workspace::new(
|
let mut workspace = Workspace::new(
|
||||||
Some(workspace_id),
|
Some(workspace_id),
|
||||||
project_handle.clone(),
|
project_handle.clone(),
|
||||||
app_state.clone(),
|
app_state.clone(),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
);
|
||||||
|
|
||||||
|
workspace.centered_layout = centered_layout;
|
||||||
|
workspace
|
||||||
});
|
});
|
||||||
})?;
|
})?;
|
||||||
window
|
window
|
||||||
|
@ -7051,6 +7059,11 @@ async fn open_ssh_project_inner(
|
||||||
Workspace::new(Some(workspace_id), project, app_state.clone(), window, cx);
|
Workspace::new(Some(workspace_id), project, app_state.clone(), window, cx);
|
||||||
workspace.set_serialized_ssh_project(serialized_ssh_project);
|
workspace.set_serialized_ssh_project(serialized_ssh_project);
|
||||||
workspace.update_history(cx);
|
workspace.update_history(cx);
|
||||||
|
|
||||||
|
if let Some(ref serialized) = serialized_workspace {
|
||||||
|
workspace.centered_layout = serialized.centered_layout;
|
||||||
|
}
|
||||||
|
|
||||||
workspace
|
workspace
|
||||||
});
|
});
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue