Skip to content
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

Fix stable sort when reverse option is enabled #1261

Merged
merged 1 commit into from
May 24, 2023
Merged

Fix stable sort when reverse option is enabled #1261

merged 1 commit into from
May 24, 2023

Conversation

joelim-work
Copy link
Collaborator

The dir.sort function uses stable sorting so that the relative order of equivalent elements is preserved. The problem is that if the reverse option is enabled, then the order will be reversed afterwards, so ultimately the order of equivalent elements will be reversed.

To reproduce this, just use set reverse and press ss repeatedly, and the directories will reverse their order since the directories themselves generally have the same size.

@gokcehan
Copy link
Owner

@joelim-work Looks good, thanks for the patch.

@gokcehan gokcehan merged commit ae1c138 into gokcehan:master May 24, 2023
@joelim-work joelim-work deleted the stablesort-reverse branch May 24, 2023 10:04
@gokcehan gokcehan mentioned this pull request Sep 17, 2023
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.

Reverse command works incorrectly
2 participants