Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Avoid moving tab when leader item updates

Julia46f1d5f5c244
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 7082b61949f..25fa3654d71 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -2676,7 +2676,12 @@ impl Workspace {
}
for (pane, item) in items_to_add {
- Pane::add_item(self, &pane, item.boxed_clone(), false, false, None, cx);
+ if let Some(index) = pane.update(cx, |pane, _| pane.index_for_item(item.as_ref())) {
+ pane.update(cx, |pane, cx| pane.activate_item(index, false, false, cx));
+ } else {
+ Pane::add_item(self, &pane, item.boxed_clone(), false, false, None, cx);
+ }
+
if pane == self.active_pane {
pane.update(cx, |pane, cx| pane.focus_active_item(cx));
}