Skip to content

Fixes #5125 - Preserve FileDialog selection colors when navigating via dotdot#5407

Merged
tig merged 3 commits into
developfrom
copilot/test-dot-dot-filedialog-color
May 26, 2026
Merged

Fixes #5125 - Preserve FileDialog selection colors when navigating via dotdot#5407
tig merged 3 commits into
developfrom
copilot/test-dot-dot-filedialog-color

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

Navigating up from a subdirectory via the .. row could change the selected row background in FileDialog. This updates FileDialog-specific table coloring so file-type colors do not override the table’s selected-state scheme.

Proposed Changes/Todos

  • Keep selection-state colors owned by TableView

    • FileDialog.ColorGetter now preserves the row scheme’s Focus/Active/Disabled attributes instead of rebuilding selected-state colors from file-type colors.
    • This keeps the .. row visually consistent before and after navigating up.
  • Add a focused regression test

    • Added a unit test covering the parent-row (..) path from a subdirectory and asserting the effective selected-state scheme is preserved.
return new Scheme
{
    Normal = new Attribute (foreground, background),
    HotNormal = new Attribute (foreground, background),
    Focus = args.RowScheme.Focus,
    HotFocus = args.RowScheme.HotFocus,
    Active = args.RowScheme.Active,
    HotActive = args.RowScheme.HotActive,
    Disabled = args.RowScheme.Disabled
};

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

Copilot AI assigned Copilot and tig May 25, 2026
Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add unit tests for FileDialog color issue Preserve FileDialog selection colors when navigating via .. May 25, 2026
Copilot finished work on behalf of tig May 25, 2026 01:29
Copilot AI requested a review from tig May 25, 2026 01:29
@tig tig marked this pull request as ready for review May 25, 2026 03:28
@tig tig requested a review from Copilot May 25, 2026 03:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a visual inconsistency in FileDialog where navigating up via the .. row could cause selected-row background colors to change unexpectedly. It does so by ensuring FileDialog’s per-cell coloring does not override TableView’s selection-state scheme.

Changes:

  • Update FileDialog’s table ColorGetter to preserve TableView’s selection-state attributes (Focus/HotFocus/Active/HotActive/Disabled) instead of recomputing them from file-type colors.
  • Add a regression unit test that exercises the .. (parent) row coloring behavior from a subdirectory state.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Terminal.Gui/Views/FileDialogs/FileDialog.TableView.cs Preserve TableView-owned selection/active/disabled scheme roles when applying file-type coloring.
Tests/UnitTestsParallelizable/Views/FileDialogColorTests.cs Add regression coverage ensuring the parent-row color getter retains selection/active scheme roles.

Comment thread Tests/UnitTestsParallelizable/Views/FileDialogColorTests.cs Outdated
@tig tig changed the title Preserve FileDialog selection colors when navigating via .. Fixes #5125 - Preserve FileDialog selection colors when navigating via dotdot May 25, 2026
Capture tableView.Table into a non-null local variable after asserting,
eliminating repeated nullable dereferences and potential compiler warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tig tig requested review from BDisp and tznind May 25, 2026 19:21
Copy link
Copy Markdown
Collaborator

@BDisp BDisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dot dot in FileDialog changes color

4 participants