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.

Properly compute depth and path for project panel entries (#19068)

Kirill Bulatov79ed217e4243
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 26a2bf27e09..b4f07c66d30 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -1911,11 +1911,9 @@ impl ProjectPanel {
Some(Arc::<Path>::from(full_path.join(suffix)))
})
})
+ .or_else(|| entry.path.file_name().map(Path::new).map(Arc::from))
.unwrap_or_else(|| entry.path.clone());
- let depth = path
- .strip_prefix(worktree_abs_path)
- .map(|suffix| suffix.components().count())
- .unwrap_or_default();
+ let depth = path.components().count();
(depth, path)
};
let width_estimate = item_width_estimate(