workspace: Clean up empty panes left over from file opening failures (#34908)
Closes #34583 Release Notes: - Fixed empty pane being left after a binary file is dropped into a new pane.s
This commit is contained in:
parent
d09c9d58c7
commit
a3a6ea264d
1 changed files with 25 additions and 16 deletions
|
@ -3239,28 +3239,37 @@ impl Pane {
|
||||||
split_direction = None;
|
split_direction = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(open_task) = workspace.update_in(cx, |workspace, window, cx| {
|
if let Ok((open_task, to_pane)) =
|
||||||
if let Some(split_direction) = split_direction {
|
workspace.update_in(cx, |workspace, window, cx| {
|
||||||
to_pane = workspace.split_pane(to_pane, split_direction, window, cx);
|
if let Some(split_direction) = split_direction {
|
||||||
}
|
to_pane =
|
||||||
workspace.open_paths(
|
workspace.split_pane(to_pane, split_direction, window, cx);
|
||||||
paths,
|
}
|
||||||
OpenOptions {
|
(
|
||||||
visible: Some(OpenVisible::OnlyDirectories),
|
workspace.open_paths(
|
||||||
..Default::default()
|
paths,
|
||||||
},
|
OpenOptions {
|
||||||
Some(to_pane.downgrade()),
|
visible: Some(OpenVisible::OnlyDirectories),
|
||||||
window,
|
..Default::default()
|
||||||
cx,
|
},
|
||||||
)
|
Some(to_pane.downgrade()),
|
||||||
}) {
|
window,
|
||||||
|
cx,
|
||||||
|
),
|
||||||
|
to_pane,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
{
|
||||||
let opened_items: Vec<_> = open_task.await;
|
let opened_items: Vec<_> = open_task.await;
|
||||||
_ = workspace.update(cx, |workspace, cx| {
|
_ = workspace.update_in(cx, |workspace, window, cx| {
|
||||||
for item in opened_items.into_iter().flatten() {
|
for item in opened_items.into_iter().flatten() {
|
||||||
if let Err(e) = item {
|
if let Err(e) = item {
|
||||||
workspace.show_error(&e, cx);
|
workspace.show_error(&e, cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if to_pane.read(cx).items_len() == 0 {
|
||||||
|
workspace.remove_pane(to_pane, None, window, cx);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue