-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Keep sort order when filtering lists sorted by date #3282
Conversation
f7efa9a
to
3a9a7b4
Compare
3a9a7b4
to
2c7dc31
Compare
7a8ebab
to
be13508
Compare
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesYou may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation |
The argument of seeing the best match first in the suggestions view convinced me that it's not desirable to retain the sort order in all lists, but only in those where things are sorted by date. However, suggestion lists are not affected by this change at all, as they are not using the So I made this configurable, and chose to retain the sort order only in the local and remote branches views (but only when sorting by date or recency), and in the stashes and reflog views. And in the menu view, because we can then keep the section headers in the keybindings menu, which is very useful. All other views now sort by best match as before. |
We'll need this to use the slices.Sort function in the next commit. It would also be possible to use sort.Ints instead, but it's slower.
For some lists it is useful to keep the same sort order when filtering (rather than sorting by best match like we usually do). Add an optional function to FilteredList to make this possible, and use it whenever we show lists of things sorted by date (branches, stashes, reflog entries), as well as menu items because this allows us to keep the section headers in the keybindings menu, which is useful for understanding what you are looking at when filtering.
be13508
to
9f0b4d0
Compare
@jesseduffield When we tested this today, it didn't work correctly when changing the sort order for local branches. The reason was that I was testing my local integration branch that had a much older version of this PR, which didn't make the distinction of alphabetical vs. by date yet. I tested this one again, works as expected. Apart from that, we decided to go with this version and see if people complain, so I'm going to merge now. |
Keep the sort order stable when filtering lists of things sorted by date (branches, stashes, reflog entries).
go generate ./...
)docs/Config.md
) have been updated if necessary