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

feat: enable the ability to sort the which key #662

Merged
merged 5 commits into from
Feb 12, 2024

Conversation

abhaysp95
Copy link
Contributor

@abhaysp95 abhaysp95 commented Feb 11, 2024

Closes #652 - @taylo2allen

  • sort "which" window in following way:
    • sort_by: "key|desc|none"
    • sort_sensitive: true|false
    • sort_reverse: true|false

    * sort "which" window in following way:
	- sort_by: "key|desc|none"
	- sort_sensitive: true|false
	- sort_reverse: true|false
@Rolv-Apneseth
Copy link
Contributor

You should do a quick format on this - cargo +nightly fmt

@abhaysp95
Copy link
Contributor Author

Done the formatting changes

@sxyazi
Copy link
Owner

sxyazi commented Feb 12, 2024

Thank you for the PR! @abhaysp95

I've made some little changes, would you like to give it a review?

@sxyazi sxyazi changed the title feat: Enable the ability to sort the which key feat: enable the ability to sort the which key Feb 12, 2024
// 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());
Copy link
Contributor

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();

Copy link
Owner

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

@Rolv-Apneseth
Copy link
Contributor

Does the sorting work for you? I think commit b44452d breaks it for me.

@sxyazi
Copy link
Owner

sxyazi commented Feb 12, 2024

Does the sorting work for you? I think commit b44452d breaks it for me.

Hi, I pushed a new commit should fix this.

@Rolv-Apneseth
Copy link
Contributor

Nice, that fixed it

@abhaysp95
Copy link
Contributor Author

Thank you for the PR! @abhaysp95

I've made some little changes, would you like to give it a review?

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.

@sxyazi
Copy link
Owner

sxyazi commented Feb 12, 2024

Thanks for the review, alright let me merge it!

@sxyazi sxyazi merged commit 84616bd into sxyazi:main Feb 12, 2024
5 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable the ability to sort the which key
3 participants