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.

pane: Do not autopin new item created as a neighbour of pinned tab (#18072)

Piotr Osiewiczd2894ce9c995
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index 09b4683c0c5..a5f83f961f0 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -831,13 +831,14 @@ impl Pane {
}
}
}
- // If no destination index is specified, add or move the item after the active item.
+ // If no destination index is specified, add or move the item after the
+ // active item (or at the start of tab bar, if the active item is pinned)
let mut insertion_index = {
cmp::min(
if let Some(destination_index) = destination_index {
destination_index
} else {
- self.active_item_index + 1
+ cmp::max(self.active_item_index + 1, self.pinned_count())
},
self.items.len(),
)