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.

project_panel: Fix crash when adding a new file or directory to the first folded directory (#23217)

timsb1375ab946b0
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 928c5475f4b..28335f5f8d6 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -2368,7 +2368,8 @@ impl ProjectPanel {
let depth = old_ancestors
.get(&entry.id)
.map(|ancestor| ancestor.current_ancestor_depth)
- .unwrap_or_default();
+ .unwrap_or_default()
+ .min(auto_folded_ancestors.len());
if let Some(edit_state) = &mut self.edit_state {
if edit_state.entry_id == entry.id {
edit_state.depth = depth;