Repository navigation
SearchableList: re-rank while typing, and make Enter confirm the best match - #579
Merged
Merged
Conversation
…n Enter Co-authored-by: matt-edmondson <19528727+matt-edmondson@users.noreply.github.com>
Co-authored-by: matt-edmondson <19528727+matt-edmondson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix SearchableList popup to update ranking on search input
SearchableList: re-rank while typing, and make Enter confirm the best match
Oct 1, 2026
matt-edmondson
marked this pull request as ready for review
October 2, 2026 13:01
|
This was referenced Oct 7, 2026
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.



SearchableList<TItem>drew its search box withImGuiInputTextFlags.EnterReturnsTrue. With that flag, ImGui only writes the edited text back on Enter or when the box loses focus, sosearchTermstayed""while the user typed and the list never re-ranked. Enter then confirmedcachedValue ?? selectedItembefore the list was ranked against the new term. That was the first unranked row, or the default item if one was passed. TypingCherryand pressing Enter confirmedApple.Changes (
ImGui.Popups/SearchableList.cs)EnterReturnsTrue, sosearchTermchanges on every keystroke and the ranking follows it.Enter/KeypadEnteris pressed while the box is active or was just deactivated. Single-line Enter deactivates the box in that same frame, so checking only for active would miss it.Tests (
tests/ImGui.Popups.Tests/SearchableListTests.cs)New cases:
Cherrymoves the Cherry row above Apple.Cherrythen pressing Enter confirms Cherry, with no current choice and withAppleas the current choice.The first three fail against the previous implementation.