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: Do not allow collapsing auto-folded directory past the list of ancestors (#17594)

Piotr Osiewiczdd257b8412c3
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index be945cde773..9add77c864d 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -637,7 +637,9 @@ impl ProjectPanel {
fn collapse_selected_entry(&mut self, _: &CollapseSelectedEntry, cx: &mut ViewContext<Self>) {
if let Some((worktree, mut entry)) = self.selected_entry(cx) {
if let Some(folded_ancestors) = self.ancestors.get_mut(&entry.id) {
- if folded_ancestors.current_ancestor_depth < folded_ancestors.max_ancestor_depth() {
+ if folded_ancestors.current_ancestor_depth + 1
+ < folded_ancestors.max_ancestor_depth()
+ {
folded_ancestors.current_ancestor_depth += 1;
cx.notify();
return;