Skip to content

Fixes #836. Improve discoverability of CommandNotBound bubbling pattern for mouse events#5302

Merged
tig merged 2 commits into
developfrom
copilot/improve-command-not-bound-bubbling
May 13, 2026
Merged

Fixes #836. Improve discoverability of CommandNotBound bubbling pattern for mouse events#5302
tig merged 2 commits into
developfrom
copilot/improve-command-not-bound-bubbling

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

Fixes

The mouse-wheel forwarding pattern (MouseBinding without AddCommand → CommandNotBound → TryBubbleUp → ancestor handles) works well but is undocumented and requires reading source to discover.

Proposed Changes/Todos

  • Add "Mouse Event Forwarding via Command Bubbling" section to docfx/docs/mouse.md — pattern explanation, code example, AdornmentView special case
  • Add Level 4 mermaid diagram to docfx/docs/command-diagrams.md showing the full flow
  • Improve CommandsToBubbleUp XML docs — mouse-wheel pattern example, clarify Padding/Border/Margin bubble to Adornment.Parent
  • Improve CommandNotBound/OnCommandNotBound XML docs — explain "binding without handler" is intentional and idiomatic

The documented pattern:

// Parent: handles commands and opts into bubbling
editor.CommandsToBubbleUp = [Command.ScrollUp, Command.ScrollDown];

// Child: binds mouse wheel WITHOUT AddCommand — command bubbles to ancestor
gutter.MouseBindings.Add (MouseFlags.WheeledUp, Command.ScrollUp);
gutter.MouseBindings.Add (MouseFlags.WheeledDown, Command.ScrollDown);

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

… mouse events

- Add "Mouse Event Forwarding via Command Bubbling" section to mouse.md
  with pattern explanation, code example, and AdornmentView special case
- Add "Level 4" mermaid diagram to command-diagrams.md showing the
  MouseBinding → CommandNotBound → TryBubbleUp → ancestor flow
- Improve CommandsToBubbleUp XML docs with mouse-wheel forwarding example
- Improve CommandNotBound/OnCommandNotBound XML docs explaining the
  intentional "binding without handler" idiom

Fixes #836

Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/caf0d0a6-c2ef-4abe-bdb3-fb2311bb1f21

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve discoverability of CommandNotBound bubbling pattern for mouse events Fixes #836. Improve discoverability of CommandNotBound bubbling pattern for mouse events May 13, 2026
Copilot AI requested a review from tig May 13, 2026 07:04
Copilot finished work on behalf of tig May 13, 2026 07:04
@tig tig marked this pull request as ready for review May 13, 2026 07:20
@tig tig merged commit 5466310 into develop May 13, 2026
13 checks passed
@tig tig deleted the copilot/improve-command-not-bound-bubbling branch May 13, 2026 07:20
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.

Improve discoverability of CommandNotBound bubbling pattern for mouse events

2 participants