project_panel: Fix indent guide collapse on secondary click for multiple worktrees (#33939)

Release Notes:

- Fixed issue where `cmd`/`ctrl` click on indent guide would not
collapse directory in case of multiple projects.
This commit is contained in:
Smit Barmase 2025-07-05 05:57:37 +05:30 committed by GitHub
parent 44d1f512f8
commit 76fe33245f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}