sort cards whose names exactly match the search query#3108
Merged
mercury233 merged 1 commit intoJun 19, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the deck builder’s search results deterministic when multiple cards exactly match the search query (notably alternate-art / reprint variants), by sorting that exact-match “front” group by card ID after it is moved to the front of the results list.
Changes:
- After partitioning exact-name matches to the front of
results, sorts that exact-match subrange by card ID. - Adds a dedicated
DataManager::deck_sort_idcomparator and exposes it inDataManager’s header.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| gframe/deck_con.cpp | Sorts the exact-match prefix of the filtered results by ID to ensure stable ordering. |
| gframe/data_manager.h | Declares a new deck_sort_id comparator for reuse in sorting. |
| gframe/data_manager.cpp | Implements deck_sort_id as an ID (code) ascending comparator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, cards whose names exactly match the search query are moved to the front. However, the processing order may default to ID order, causing alternate-art cards to be handled last and finally making an alternate-art card always appear first.
This change adds a secondary sort to reorder the exact-match cards by ID, ensuring they are displayed in the correct order.