Skip to content

Fixes #4926. Remove IDriver.GetVersionInfo, add IDriver.KittyKeyboardCapabilities#4927

Merged
tig merged 18 commits intodevelopfrom
copilot/remove-get-version-info-add-kitty-keyboard-capabil
Apr 11, 2026
Merged

Fixes #4926. Remove IDriver.GetVersionInfo, add IDriver.KittyKeyboardCapabilities#4927
tig merged 18 commits intodevelopfrom
copilot/remove-get-version-info-add-kitty-keyboard-capabil

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Removes IDriver.GetVersionInfo() (redundant with GetName()) and promotes kitty keyboard protocol state to a first-class IDriver property, eliminating the need for callers to cast to DriverImpl.

Proposed Changes/Todos

  • Remove GetVersionInfo() from IDriver and DriverImpl; update UICatalogRunnable to call GetName() directly with a null-safe fallback
  • Rename KittyKeyboardProtocolResultKittyKeyboardCapabilities (file rename + class rename, updated XML docs)
  • Add KittyKeyboardCapabilities? KittyKeyboardCapabilities { get; } (get-only) to IDriver, following the same pattern as ColorCapabilities
  • DriverImpl implements the property as { get; private set; } with an internal void SetKittyKeyboardCapabilities() method — only MainLoopCoordinator (which holds a concrete DriverImpl) can update it, keeping capability detection authoritative
  • KittyKeyboardProtocolDetector.Detect() no longer directly assigns driver state — the detector only detects and invokes the callback
  • MainLoopCoordinator calls _driver?.SetKittyKeyboardCapabilities(result) when detection confirms support
  • All tests updated to use KittyKeyboardCapabilities type and driver.KittyKeyboardCapabilities property; Assert.NotNull added before accessing members to strengthen assertions

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

Copilot AI changed the title [WIP] Remove IDriver.GetVersionInfo and add IDriver.KittyKeyboardCapabilities Fixes #3999. Remove IDriver.GetVersionInfo, add IDriver.KittyKeyboardCapabilities Apr 10, 2026
Copilot AI requested a review from tig April 10, 2026 16:08
Copilot finished work on behalf of tig April 10, 2026 16:08
@tig tig requested a review from Copilot April 10, 2026 19:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the driver abstraction by removing IDriver.GetVersionInfo() and exposing kitty keyboard protocol detection results as a first-class IDriver.KittyKeyboardCapabilities property, eliminating the need for callers to reach into DriverImpl internals.

Changes:

  • Removed IDriver.GetVersionInfo() and updated the UICatalog status display to use GetName() instead.
  • Renamed KittyKeyboardProtocolResult to KittyKeyboardCapabilities and updated kitty keyboard detection plumbing to store capabilities on the driver.
  • Updated callers/tests to use the renamed type and the new IDriver property.

Reviewed changes

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

Show a summary per file
File Description
Tests/UnitTestsParallelizable/Drivers/AnsiHandling/KittyKeyboardProtocolDetectorTests.cs Updates tests to use KittyKeyboardCapabilities naming.
Tests/UnitTestsParallelizable/Application/MainLoopCoordinatorTests.cs Updates assertions to use driver.KittyKeyboardCapabilities.
Terminal.Gui/Drivers/IDriver.cs Removes GetVersionInfo() and adds KittyKeyboardCapabilities to the public interface.
Terminal.Gui/Drivers/DriverImpl.cs Removes GetVersionInfo() implementation and stores detected kitty keyboard capabilities.
Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardProtocolDetector.cs Renames detection result type usage to KittyKeyboardCapabilities.
Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardCapabilities.cs Renames the capabilities/result type and updates XML docs.
Terminal.Gui/App/MainLoop/MainLoopCoordinator.cs Stores detected kitty keyboard capabilities via the new setter.
Examples/UICatalog/UICatalogRunnable.cs Replaces GetVersionInfo() with GetName() for display.
Comments suppressed due to low confidence (1)

Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardCapabilities.cs:22

  • KittyKeyboardCapabilities is now exposed via the public IDriver API, but its properties have public setters. This allows any consumer to mutate IsSupported/SupportedFlags/EnabledFlags and potentially put the driver into an invalid state. Consider making the type immutable (get/init-only) or restricting setters (e.g., internal/private set) and updating internal code accordingly.

Comment thread Terminal.Gui/Drivers/IDriver.cs Outdated
Comment thread Tests/UnitTestsParallelizable/Application/MainLoopCoordinatorTests.cs Outdated
Comment thread Examples/UICatalog/UICatalogRunnable.cs Outdated
tig and others added 4 commits April 10, 2026 15:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…bil' of tig:gui-cs/Terminal.Gui into copilot/remove-get-version-info-add-kitty-keyboard-capabil
Centralize Kitty keyboard enable/disable logic in KittyKeyboardProtocolDetector, removing it from AnsiOutput. Simplify KittyKeyboardCapabilities by replacing SupportedFlags and EnabledFlags with a single Flags property. Update MainLoopCoordinator and driver to use the new API, and make KittyKeyboardCapabilities settable on IDriver. Update all usages and tests to use the new Flags property. Remove obsolete code and tests from AnsiOutput. Improve logging and tracing for Kitty protocol detection and driver initialization. Update Keys scenario and UICatalogRunnable to display Kitty protocol status using the new approach.
Enhances driver and main loop to reliably enable kitty keyboard mode on startup (with post-enable detection of actual flags) and disable it on shutdown before disposing output. Updates KittyKeyboardProtocolDetector to confirm and store enabled flags. Reduces debug output by commenting trace lines. Updates docs to clarify negotiation and shutdown flow. Adds/updates tests to verify enable/disable sequences and capability updates.
@tig tig changed the title Fixes #3999. Remove IDriver.GetVersionInfo, add IDriver.KittyKeyboardCapabilities Fixes #4926. Remove IDriver.GetVersionInfo, add IDriver.KittyKeyboardCapabilities Apr 11, 2026
tig added 3 commits April 10, 2026 21:09
Added a new test region to KittyKeyboardPipelineTests to ensure no duplicate KeyDown events are raised when both Kitty CSI-u sequences and legacy printable characters are received for the same keypress. Tests cover generic printable keys, Portuguese keyboard characters, and Kitty sequences with associated text, addressing terminal behaviors that emit both input types.
…nput

Added suppression logic in AnsiInputProcessor to prevent duplicate keydown events when both Kitty CSI-u and legacy printable sequences are received for the same key. Introduced virtual methods in InputProcessorImpl for customizable suppression. Updated related tests for style consistency.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 12 comments.

Comment thread Terminal.Gui/Drivers/IDriver.cs
Comment thread Terminal.Gui/Drivers/IDriver.cs Outdated
Comment thread Terminal.Gui/Drivers/DriverImpl.cs
Comment thread Terminal.Gui/Drivers/AnsiDriver/AnsiSizeMonitor.cs
Comment thread Terminal.Gui/Drivers/AnsiDriver/AnsiSizeMonitor.cs
Comment thread Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardProtocolDetector.cs Outdated
Comment thread Terminal.Gui/App/MainLoop/MainLoopCoordinator.cs Outdated
Comment thread Terminal.Gui/App/MainLoop/MainLoopCoordinator.cs
Comment thread Terminal.Gui/App/MainLoop/ApplicationMainLoop.cs Outdated
Comment thread docfx/docs/drivers.md
tig and others added 2 commits April 10, 2026 22:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
tig and others added 4 commits April 10, 2026 22:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ity to DriverImpl.SetKittyKeyboardCapabilities

Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/3b2bd475-1a29-40c5-877b-3b81ae948a10

Co-authored-by: tig <585482+tig@users.noreply.github.com>
tig added 2 commits April 11, 2026 16:43
…bil' of tig:gui-cs/Terminal.Gui into copilot/remove-get-version-info-add-kitty-keyboard-capabil
Copy link
Copy Markdown
Collaborator

@BDisp BDisp left a comment

Choose a reason for hiding this comment

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

Well planned and implemented. Converting isolated characters to a CSI-u sequence on the keydown event is a truly elegant solution. Thanks.

@tig tig merged commit e532d61 into develop Apr 11, 2026
11 checks passed
@tig tig deleted the copilot/remove-get-version-info-add-kitty-keyboard-capabil branch April 11, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants