-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable the ability to sort the which key #662
Conversation
* sort "which" window in following way: - sort_by: "key|desc|none" - sort_sensitive: true|false - sort_reverse: true|false
formatted properly
You should do a quick format on this - |
Done the formatting changes |
Thank you for the PR! @abhaysp95 I've made some little changes, would you like to give it a review? |
yazi-core/src/which/sorter.rs
Outdated
// in case if it is not present, should I just panic ? | ||
by_alphabetical(a.desc.as_ref().unwrap(), b.desc.as_ref().unwrap()) | ||
}), | ||
let mut new = Vec::with_capacity(indices.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this:
*items = indices.into_iter().map(|i| mem::take(&mut items[i])).collect();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, will apply this suggestion
Does the sorting work for you? I think commit b44452d breaks it for me. |
Hi, I pushed a new commit should fix this. |
Nice, that fixed it |
It looks like I wrote the code in a verbose way. I tried to follow the example of how it was implemented for FileSorter. Maybe I thought that this will help in being more open to future changes. But I don't have any such problems with the change. All fine by me. |
Thanks for the review, alright let me merge it! |
Closes #652 - @taylo2allen