Broadcast active view to followers

This commit is contained in:
Antonio Scandurra 2022-03-18 16:00:03 +01:00
parent 3d81eb9ddf
commit 7d7e10598a
5 changed files with 182 additions and 48 deletions

View file

@ -321,11 +321,12 @@ impl Pane {
pub(crate) fn add_item(
workspace: &mut Workspace,
pane: ViewHandle<Pane>,
mut item: Box<dyn ItemHandle>,
item: Box<dyn ItemHandle>,
cx: &mut ViewContext<Workspace>,
) {
// Prevent adding the same item to the pane more than once.
if pane.read(cx).items.iter().any(|i| i.id() == item.id()) {
if let Some(item_ix) = pane.read(cx).items.iter().position(|i| i.id() == item.id()) {
pane.update(cx, |pane, cx| pane.activate_item(item_ix, cx));
return;
}