Skip to content

Fixes #5369. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace - #5378

Merged
tig merged 2 commits into
developfrom
tig/fix-bind-platformkeybinding-namespace
May 23, 2026
Merged

Fixes #5369. Move Bind and PlatformKeyBinding to Terminal.Gui.Input namespace#5378
tig merged 2 commits into
developfrom
tig/fix-bind-platformkeybinding-namespace

Conversation

@tig

@tig tig commented May 23, 2026

Copy link
Copy Markdown
Member

Summary

Moves Bind and PlatformKeyBinding from namespace Terminal.Gui to namespace Terminal.Gui.Input to 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.Editor NuGet package (v2.2.5) has compiled IL referencing Terminal.Gui.Bind and Terminal.Gui.PlatformKeyBinding. Simply moving the namespace would cause TypeLoadException at 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 had using Terminal.Gui.Input;, so no source changes were needed — just a recompile.

Changes

  • Terminal.Gui/Input/Keyboard/Bind.csnamespace Terminal.Gui;namespace Terminal.Gui.Input;
  • Terminal.Gui/Input/Keyboard/PlatformKeyBinding.csnamespace Terminal.Gui;namespace Terminal.Gui.Input;
  • Directory.Packages.props — Editor version → 2.2.6-local
  • nuget.config — Allow Terminal.Gui.Editor from LocalPackages source
  • local_packages/ — Replace old TG nupkgs with new Editor nupkg

Verification

  • ✅ Full solution builds (0 errors)
  • ✅ 17,062 parallelizable tests pass
  • ✅ 72 non-parallelizable tests pass
  • ✅ NativeAot example builds successfully

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

…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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread Directory.Packages.props
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>

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

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 Bind to namespace Terminal.Gui.Input.
  • Move PlatformKeyBinding to namespace Terminal.Gui.Input.
  • Update NuGet restore configuration to consume a locally-built Terminal.Gui.Editor package (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, the nuget source still allows all packages via <package pattern="*" />, so removing the explicit Terminal.Gui.Editor entry doesn’t actually restrict Editor from being restored from nuget (it’s still matched by *). If the intent is to require Terminal.Gui.Editor from LocalPackages only, 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>

Comment thread Terminal.Gui/Input/Keyboard/Bind.cs
Comment thread Directory.Packages.props

@BDisp BDisp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I only presented a slight debt, but nothing that would prevent me from approving it.

Comment thread Directory.Packages.props
@tig
tig merged commit 9c43575 into develop May 23, 2026
14 checks passed
@tig
tig deleted the tig/fix-bind-platformkeybinding-namespace branch May 23, 2026 18:40
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.

Terminal.Gui.Bind and PlatformKeyBinding are in the wrong namespace

3 participants