Fixes #5369. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace - #5378
Conversation
…amespace Move both types from namespace Terminal.Gui to namespace Terminal.Gui.Input to match their sibling types (Key, KeyBinding, KeyBindings, ModifierKey, etc.) in the same directory. To break the circular dependency with the published Terminal.Gui.Editor NuGet package (which had compiled IL referencing Terminal.Gui.Bind), a local Editor package (2.2.6-local) is built against the namespace-fixed Terminal.Gui and placed in local_packages/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d406020b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The local Editor package (2.2.6-local) depends on Terminal.Gui 2.2.2-local. Include that package in local_packages/ so restore succeeds for all projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR corrects the public API organization by moving Bind and PlatformKeyBinding into the Terminal.Gui.Input namespace so they align with the rest of the input/keyboard types in the same directory.
Changes:
- Move
Bindtonamespace Terminal.Gui.Input. - Move
PlatformKeyBindingtonamespace Terminal.Gui.Input. - Update NuGet restore configuration to consume a locally-built
Terminal.Gui.Editorpackage (2.2.6-local) to avoid runtime failures from downstream binaries compiled against the old namespaces.
Reviewed changes
Copilot reviewed 4 out of 9 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Terminal.Gui/Input/Keyboard/Bind.cs | Moves Bind into Terminal.Gui.Input. |
| Terminal.Gui/Input/Keyboard/PlatformKeyBinding.cs | Moves PlatformKeyBinding into Terminal.Gui.Input. |
| Directory.Packages.props | Pins Terminal.Gui.Editor to 2.2.6-local to match the namespace change workaround. |
| nuget.config | Adjusts package source mapping configuration related to local packages. |
Comments suppressed due to low confidence (1)
nuget.config:20
- In
packageSourceMapping, thenugetsource still allows all packages via<package pattern="*" />, so removing the explicitTerminal.Gui.Editorentry doesn’t actually restrict Editor from being restored from nuget (it’s still matched by*). If the intent is to requireTerminal.Gui.EditorfromLocalPackagesonly, you’ll need to replace the*catch-all with explicit non-Terminal.Gui*patterns (packageSourceMapping doesn’t support negative patterns).
<packageSourceMapping>
<packageSource key="nuget">
<package pattern="*" />
</packageSource>
<packageSource key="LocalPackages">
<package pattern="Terminal.Gui*" />
</packageSource>
BDisp
left a comment
There was a problem hiding this comment.
I only presented a slight debt, but nothing that would prevent me from approving it.
Summary
Moves
BindandPlatformKeyBindingfromnamespace Terminal.Guitonamespace Terminal.Gui.Inputto match their sibling types (Key,KeyBinding,KeyBindings,ModifierKey, etc.) in the same directory.Breaking the Circular Dependency
PR #5372 documented that the published
Terminal.Gui.EditorNuGet package (v2.2.5) has compiled IL referencingTerminal.Gui.BindandTerminal.Gui.PlatformKeyBinding. Simply moving the namespace would causeTypeLoadExceptionat runtime.Solution: Build a local Editor package (v2.2.6-local) against the namespace-fixed Terminal.Gui and place it in
local_packages/. The Editor source already hadusing Terminal.Gui.Input;, so no source changes were needed — just a recompile.Changes
Terminal.Gui/Input/Keyboard/Bind.cs—namespace Terminal.Gui;→namespace Terminal.Gui.Input;Terminal.Gui/Input/Keyboard/PlatformKeyBinding.cs—namespace Terminal.Gui;→namespace Terminal.Gui.Input;Directory.Packages.props— Editor version →2.2.6-localnuget.config— AllowTerminal.Gui.Editorfrom LocalPackages sourcelocal_packages/— Replace old TG nupkgs with new Editor nupkgVerification
Follow-up
Once this merges and a TG release is published, the Editor repo should publish a proper release to NuGet, and the local package hack can be removed.
Fixes: #5369