Skip to content

Conversation

@lorenjphillips
Copy link

Noticed the file tree sort mode wasnt actually re-sorting when you switched modes - you had to collapse and re-expand directories to see the change. Found the TODO comment at view.rs:268 and figured I'd take a crack at it.

Changes

  • Added SortMode::comparator() that returns the right comparison fn for each mode
  • Added FileTree::sort_all_nodes() to re-sort all expanded directories
  • Updated set_sort_mode() to trigger the resort

Testing

  • added two tests for the sort mode switching behavior
  • ran cargo test file_tree - all 36 tests pass
  • built with cargo build --lib, no new warnings

Let me know if you want me to change anythign!

@sinelaw
Copy link
Owner

sinelaw commented Dec 7, 2025

Where in the UI can I see the effect of this change?

@lorenjphillips
Copy link
Author

Thanks for reviewing this! sort mode isn't wired up to any keybinding yet... I added the fix first figuring the UI part would be simpler to add on top, happy to add what I built for myself but figured you may be opinionated about UI :)

Where in the UI can I see the effect of this change?

@sinelaw
Copy link
Owner

sinelaw commented Dec 8, 2025

Gotcha
I'll take a look at adding sort to the file explorer ui

@lorenjphillips
Copy link
Author

Thanks so much!! Let me know if you would like any more changes in the PR for the sort!!

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.

2 participants