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 indent guide collapse on secondary click for multiple worktrees (#33939)

Smit Barmase76fe33245fcf
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 614f8ccf819..ded6e0e3f48 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -3303,12 +3303,13 @@ impl ProjectPanel {
fn entry_at_index(&self, index: usize) -> Option<(WorktreeId, GitEntryRef<'_>)> {
let mut offset = 0;
for (worktree_id, visible_worktree_entries, _) in &self.visible_entries {
- if visible_worktree_entries.len() > offset + index {
+ let current_len = visible_worktree_entries.len();
+ if index < offset + current_len {
return visible_worktree_entries
- .get(index)
+ .get(index - offset)
.map(|entry| (*worktree_id, entry.to_ref()));
}
- offset += visible_worktree_entries.len();
+ offset += current_len;
}
None
}