Skip to content

Conversation

@esmuellert
Copy link
Owner

Summary

Fixes issue where folders in tree view would immediately re-expand after being manually collapsed.

Problem

When the explorer refreshes (triggered by BufEnter or git directory changes), all directories were being forcibly re-expanded via expand_all_dirs(), discarding the user's manual collapse state.

Solution

  • Added collect_collapsed_state() to capture which groups/directories are collapsed before refresh
  • Added restore_collapsed_state() to restore the collapsed state after tree rebuild
  • State is keyed by path for directories and name for groups

Testing

  • All existing tests pass
  • Manual testing confirms folders stay collapsed after refresh

Fixes #169

Fixes issue where folders in tree view would immediately re-expand
after being manually collapsed. The refresh triggered by BufEnter
or git directory changes was forcibly expanding all directories.

Solution: Collect collapsed state before async refresh, restore it
after tree rebuild.

Fixes #169
@esmuellert esmuellert enabled auto-merge January 12, 2026 22:19
@esmuellert esmuellert merged commit 7101d2b into main Jan 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot close folder in the explorer

2 participants