Allow an empty center group to successfully deserialize into an empty pane.
Fix error when deserializing pane axis which caused it's members.len() > 1 invariant to be violated Fix failure to gain center pane focus when failing to deserialize a center pane entirely Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
cd2d593a6c
commit
9bf0a02eae
3 changed files with 26 additions and 11 deletions
|
@ -106,7 +106,6 @@ impl SerializedPaneGroup {
|
|||
.await
|
||||
{
|
||||
members.push(new_member);
|
||||
|
||||
current_active_pane = current_active_pane.or(active_pane);
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +114,10 @@ impl SerializedPaneGroup {
|
|||
return None;
|
||||
}
|
||||
|
||||
if members.len() == 1 {
|
||||
return Some((members.remove(0), current_active_pane));
|
||||
}
|
||||
|
||||
Some((
|
||||
Member::Axis(PaneAxis {
|
||||
axis: *axis,
|
||||
|
@ -130,9 +133,10 @@ impl SerializedPaneGroup {
|
|||
.deserialize_to(project, &pane, workspace_id, workspace, cx)
|
||||
.await;
|
||||
|
||||
if pane.read_with(cx, |pane, _| pane.items().next().is_some()) {
|
||||
if pane.read_with(cx, |pane, _| pane.items_len() != 0) {
|
||||
Some((Member::Pane(pane.clone()), active.then(|| pane)))
|
||||
} else {
|
||||
workspace.update(cx, |workspace, cx| workspace.remove_pane(pane, cx));
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue