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.
Might fix #2704
I can't replicate that issue just yet so i have no idea
It could be a classic race condition. When the UI selects an entry, it only stores the index of the selected item, not the actual entry itself. Then later, when it comes time to actually return the command, it goes back to the results array and grabs whatever is at that index. This is fine most of the time...
BUT - if anything changed the results array between selection and execution (like a new search query being processed), the index would still point to the same position, but that position might now contain a completely different history entry! 🫠
There's another potential cause too. We have the main loop, that handles calling draw + also updating the results when needed. But an inner loop, that processes all input events received. If a user sends a lot of events (maybe holds the arrow key?), then there could be a discrepancy between the selected state and the currently rendered state. Ensure we also call draw when we process the Continue event.
Checks