Skip to content

Fixes #5509 branch color getter invoker now applies Active attribute#5510

Merged
YourRobotOverlord merged 6 commits into
tui-cs:developfrom
YourRobotOverlord:fix-Branch-color-getter-invoker
Jun 21, 2026
Merged

Fixes #5509 branch color getter invoker now applies Active attribute#5510
YourRobotOverlord merged 6 commits into
tui-cs:developfrom
YourRobotOverlord:fix-Branch-color-getter-invoker

Conversation

@YourRobotOverlord

@YourRobotOverlord YourRobotOverlord commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Proposed Changes/Todos

  • Extends Tree View scenario to include a custom color delegate. Enable/disable using new Style menu.
  • Fixes delegate invoker to also apply Active attribute.

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

Before

WindowsTerminal_wniYIxLAuo

After

WindowsTerminal_MSFGFpX2T3

@YourRobotOverlord YourRobotOverlord marked this pull request as ready for review June 21, 2026 18:20
@YourRobotOverlord YourRobotOverlord requested a review from tig as a code owner June 21, 2026 18:20
@tig tig requested a review from Copilot June 21, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes TreeView branch rendering when a custom ColorGetter is used by ensuring the unfocused-but-selected state uses the Active attribute, and updates the UICatalog scenario/docs to demonstrate and explain the behavior.

Changes:

  • Update TreeView branch draw logic to use Scheme.Active for selected branches when the TreeView is unfocused.
  • Expand TreeView<T>.ColorGetter XML docs to clarify which Scheme roles are consumed.
  • Extend the UICatalog TreeView scenario with a toggleable custom color delegate.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Terminal.Gui/Views/TreeView/TreeViewT.cs Improves ColorGetter documentation, including how Normal/Focus/Active are used.
Terminal.Gui/Views/TreeView/Branch.cs Fixes selection coloring with ColorGetter by applying Active when the TreeView lacks focus.
Examples/UICatalog/Scenarios/TreeUseCases.cs Adds a scenario toggle to demonstrate ColorGetter-based per-node coloring.
Comments suppressed due to low confidence (1)

Terminal.Gui/Views/TreeView/Branch.cs:219

  • When a ColorGetter is set but returns null for a given model, the code currently sets modelColor = new Attribute () (white/black). This contradicts the ColorGetter XML docs ("null to use the default tree view scheme") and causes theme-inconsistent colors for nodes that intentionally fall back to the default scheme. Keep the existing modelColor (initialized from textColor) when modelScheme is null.
                                 : modelScheme.Normal;
            }
            else
            {
                modelColor = new Attribute ();

Comment thread Examples/UICatalog/Scenarios/TreeUseCases.cs
Comment thread Terminal.Gui/Views/TreeView/Branch.cs
YourRobotOverlord and others added 3 commits June 21, 2026 12:50
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Using custom ColorGetter breaks unfocused Active attribute on TreeView Branch

3 participants