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 expand collapsed worktrees on "collapse all entries" (#10687)

Piotr Osiewiczb9e026999157
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 5a57fbfbcdf..837e563b1c4 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -599,7 +599,10 @@ impl ProjectPanel {
}
pub fn collapse_all_entries(&mut self, _: &CollapseAllEntries, cx: &mut ViewContext<Self>) {
- self.expanded_dir_ids.clear();
+ // By keeping entries for fully collapsed worktrees, we avoid expanding them within update_visible_entries
+ // (which is it's default behaviour when there's no entry for a worktree in expanded_dir_ids).
+ self.expanded_dir_ids
+ .retain(|_, expanded_entries| expanded_entries.is_empty());
self.update_visible_entries(None, cx);
cx.notify();
}