Repository navigation
Conversation
Pressing Down, G, or Page Down before directory entries arrive can set the selection to -1. Keep it at zero while the list is empty so Enter can select the first file once it loads. Add tests for navigation before loading completes and for normal selection and navigation after loading.
andrinoff
approved these changes
Nov 18, 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.
Pressing Down, G, or Page Down before directory entries arrive can set the selection to -1. Keep it at zero while the list is empty so Enter can select the first file once it loads.
Add tests for navigation before loading completes and for normal selection and navigation after loading.
CONTRIBUTING.md.fix(filepicker): keep selection valid before entries load
Pressing Down, G, or PageDown before directory entries arrive can leave the selection at -1, and Enter then indexes outside the entries. Keep the empty selection at zero until entries exist. The regression sends keys before loading completes.
Open #963 changes the default height for #864; it does not clamp a negative selection while directory entries are pending. This fix leaves height behavior unchanged.
Separate tests cover positive behavior (
TestLoadedPickerSelectsFile), negative controls (TestLoadedPickerDoesNotNavigatePastLastEntry), and the regression (TestKeysBeforeEntriesLoad). A representative regression fails on unchanged main and passes with the fix. The positive control passes on main; a deliberate break is also caught by the negative test.Validation on owner main
1deada954e6e, Go 1.26.10:-count=1 -cpu=1,4), plus 20 focused race repetitions.Cross-target binaries were compiled rather than executed. These are local results; remote CI remains to be confirmed.
disclosure: one of a bunch of things that popped up whenworking on my own. harness. i use claude, claude root-caused. them, including this one. i reviewed this (it's a very narrow patch, so should just go in easily, tests are clean, low risk, etc, simple bug). i also asked codex to review it so that we weren't just taking claude's word on. things and while we were doing. it qwen had a look and instead told me to use rust. sometimes it's just like that.