Fixes #5200 - Prevent FileDialog Enter navigation from selecting the first file#5405
Merged
Conversation
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/b98cd71d-624b-4eca-ad46-ebca643d1a0e Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Test file dialog open folder bug with Enter key
Prevent FileDialog Enter navigation from selecting the first file
May 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an unintended FileDialog behavior where pressing Enter on a directory row in the file list could rewrite Path to the first row of the newly opened directory (making directory navigation behave like an implicit file selection). The change prevents TableViewOnValueChanged from synchronizing Path while FileDialog is internally pushing a new directory state.
Changes:
- Suppress
TableViewOnValueChangedpath synchronization when_pushingStateis true to avoid overwriting the just-opened directory path during internal navigation. - Add a regression unit test verifying that Enter-accepting a directory from the table keeps
Pathon the opened directory after navigation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Tests/UnitTestsParallelizable/Views/FileDialogResultTests.cs | Adds a regression test covering Enter navigation into a directory from the table view. |
| Terminal.Gui/Views/FileDialogs/FileDialog.TableView.cs | Guards TableViewOnValueChanged with _pushingState to prevent path rewrites during internal state transitions. |
- Replace hard-coded row index with FindRowByName helper that searches by cell content, decoupling the test from TableView ordering internals - Use Assert.EndsWith for path validation to be platform-independent - Store path before accept and compare after, testing the actual regression behavior without coupling to platform-specific path formats Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BDisp
approved these changes
May 25, 2026
Member
|
This needs @tznind's approval since he reported it. |
tznind
approved these changes
May 25, 2026
This was referenced May 28, 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.
Proposed Changes/Todos
The file dialog was rewriting
Pathto the first row in the newly opened directory when Enter was used from the table, which made folder navigation behave like an implicit file selection. This change keeps Enter-driven directory navigation on the opened directory so the file list is shown without auto-selecting the first file.FileDialogResultTestscase for Enter on a directory row in the table.TableViewOnValueChanged (...)path synchronization whileFileDialogis internally pushing a new directory state.0from overwriting the just-opened directory path.Pathremains on the opened directory.Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)