diff --git a/Terminal.Gui/Input/IAcceptTarget.cs b/Terminal.Gui/Input/IAcceptTarget.cs index f1dbf75c5a..f334219b6e 100644 --- a/Terminal.Gui/Input/IAcceptTarget.cs +++ b/Terminal.Gui/Input/IAcceptTarget.cs @@ -1,4 +1,4 @@ -namespace Terminal.Gui; +namespace Terminal.Gui.Input; /// /// Interface for views that handle as terminal destinations. diff --git a/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs b/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs index d60517b8b1..c3392d898d 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs @@ -1279,6 +1279,13 @@ public void Button_Implements_IAcceptTarget () Assert.IsAssignableFrom (button); } + // Copilot + [Fact] + public void IAcceptTarget_Is_In_Input_Namespace () + { + Assert.Equal ("Terminal.Gui.Input", typeof (IAcceptTarget).Namespace); + } + // CoPilot - ChatGPT o1 [Fact] public void NonIAcceptTarget_Handled_Does_Not_Redirect () diff --git a/docfx/README.md b/docfx/README.md index 92a47e7c27..67f141c33d 100644 --- a/docfx/README.md +++ b/docfx/README.md @@ -58,7 +58,7 @@ grep "ClassName" docfx/_site/xrefmap.yml | grep "^- uid:" | `Command`, `CommandRouting`, `ICommandContext`, `CommandContext`, `ICommandBinding`, `CommandBridge` | `Terminal.Gui.Input.` | | `View` | `Terminal.Gui.ViewBase.View` | | All view classes (`Button`, `CheckBox`, `Dialog`, etc.) | `Terminal.Gui.Views.` | -| `IAcceptTarget` | `Terminal.Gui.` | +| `IAcceptTarget` | `Terminal.Gui.Input.` | ### Syntax @@ -85,7 +85,7 @@ grep "ClassName" docfx/_site/xrefmap.yml | grep "^- uid:" | `ICommandContext` | `Terminal.Gui.Input.ICommandContext` | | `CommandContext` | `Terminal.Gui.Input.CommandContext` | | `CommandBridge` | `Terminal.Gui.Input.CommandBridge` | -| `IAcceptTarget` | `Terminal.Gui.IAcceptTarget` | +| `IAcceptTarget` | `Terminal.Gui.Input.IAcceptTarget` | | `View` | `Terminal.Gui.ViewBase.View` | | `View.CommandsToBubbleUp` | `Terminal.Gui.ViewBase.View.CommandsToBubbleUp` | | `View.DefaultAcceptView` | `Terminal.Gui.ViewBase.View.DefaultAcceptView` | diff --git a/docfx/docs/command-diagrams.md b/docfx/docs/command-diagrams.md index 84e1f8ec18..3948c7beab 100644 --- a/docfx/docs/command-diagrams.md +++ b/docfx/docs/command-diagrams.md @@ -82,7 +82,7 @@ flowchart TD - `DispatchDown` creates a new context with `Routing = DispatchingDown`, suppressing re-bubbling in the target and preventing infinite recursion. - `TextField.DefaultAcceptHandler` skips its own redirect because `acceptWillBubble = true` — this prevents double-handling. - is a property on each view that returns the first `IAcceptTarget { IsDefault: true }` SubView (typically a ). It is not inherited from the SuperView. -- returns `true` from `DefaultAcceptHandler` because it implements . +- returns `true` from `DefaultAcceptHandler` because it implements . ### Level 3: Complete Flow with MenuBarItem, Menu, and MenuItem diff --git a/docfx/docs/command.md b/docfx/docs/command.md index 05deb01067..6ad9fc29f2 100644 --- a/docfx/docs/command.md +++ b/docfx/docs/command.md @@ -324,7 +324,7 @@ Bound to `Key.Enter`. 4. If not handled, redirects to via `DispatchDown` (unless Accept will also bubble to an ancestor — prevents double-path) 5. For `BubblingUp` with a dispatch target, calls 6. Calls -7. Returns `true` if: redirected, will bubble to ancestor, routing is `BubblingUp`, or view is +7. Returns `true` if: redirected, will bubble to ancestor, routing is `BubblingUp`, or view is ### `DefaultHotKeyHandler` () @@ -404,7 +404,7 @@ Called by , : handles + redirect logic +3. For : handles + redirect logic 4. If command is in `SuperView.CommandsToBubbleUp` → invoke on SuperView with `Routing = BubblingUp` 5. Handles `Padding` edge cases (checks Padding's parent) @@ -420,14 +420,14 @@ protected bool? DispatchDown (View target, ICommandContext? ctx) Creates a with `Routing = CommandRouting.DispatchingDown` and invokes on the target. checks for `DispatchingDown` and skips bubbling, preventing infinite recursion. -### and +### and identifies the SubView that receives when no other handles it. Defaults to the first `IAcceptTarget { IsDefault: true }` SubView (typically a ). - affects flow in three ways: + affects flow in three ways: 1. **Resolution**: searches for `IAcceptTarget { IsDefault: true }` -2. **Return value**: `DefaultAcceptHandler` returns `true` for views -3. **Redirect**: Non-default sources bubble up when a exists +2. **Return value**: `DefaultAcceptHandler` returns `true` for views +3. **Redirect**: Non-default sources bubble up when a exists ## CommandBridge @@ -650,7 +650,7 @@ When an inner activates (via click/space), th 1. ** base**: Space → , Enter → , `LeftButtonReleased` → . Subclasses override or extend. -2. ****: Implements . All interactions map to . +2. ****: Implements . All interactions map to . 3. **Selector views**: Use `ConsumeDispatch=true`. Inner commands are consumed; don't propagate to SuperView.