Skip to content

IDriver.GetVersionInfo is not needed. Add IDriver.KittyKeyboardCapabilities which is a refactoring of KittyKeyboardProtocol and KittyKeyboardProtocolResult #4926

Closed

Description

@tig

Summary

Two related cleanups to IDriver:

  1. Remove IDriver.GetVersionInfo() - its only caller is UICatalogRunnable for a status bar label, and its implementation (DriverImpl) just returns "{GetName()} driver", which is redundant with GetName().

  2. Add IDriver.KittyKeyboardCapabilities - replace the scattered KittyKeyboardProtocol/KittyKeyboardProtocolResult surface with a single clean property on IDriver.


1. Remove IDriver.GetVersionInfo()

Current state

// IDriver.cs
string GetVersionInfo ();

// DriverImpl.cs
public virtual string GetVersionInfo ()
{
    return $"{GetName ()} driver";
}

// UICatalogRunnable.cs
_shVersion?.Title = $"... {App?.Driver?.GetVersionInfo ()}";

Proposed

  • Remove GetVersionInfo() from IDriver and DriverImpl.
  • Update UICatalogRunnable to call GetName() directly.

2. Add IDriver.KittyKeyboardCapabilities

Current state

KittyKeyboardProtocolResult holds three properties and is stored on DriverImpl with no corresponding member on IDriver:

public class KittyKeyboardProtocolResult
{
    public bool IsSupported { get; set; }
    public KittyKeyboardFlags SupportedFlags { get; set; }
    public KittyKeyboardFlags EnabledFlags { get; set; }
}

// DriverImpl.cs - not on IDriver, so callers must cast
public KittyKeyboardProtocolResult KittyKeyboardProtocol { get; private set; } = new ();
internal void SetKittyKeyboardProtocol (KittyKeyboardProtocolResult result) => KittyKeyboardProtocol = result;

AnsiComponentFactory.GetDriverName() works around this with a TODO comment rather than going through IDriver.

Proposed

  • Rename KittyKeyboardProtocolResult to KittyKeyboardCapabilities.
  • Add to IDriver:
/// Gets the terminal kitty keyboard protocol capabilities detected at startup.
/// null if the terminal was not queried or does not support the protocol.
KittyKeyboardCapabilities? KittyKeyboardCapabilities { get; }
  • Remove DriverImpl.SetKittyKeyboardProtocol; implement the property.
  • Update AnsiComponentFactory, KittyKeyboardProtocolDetector, MainLoopCoordinator, and all tests/scenarios.

Affected Files

File Change
Terminal.Gui/Drivers/IDriver.cs Remove GetVersionInfo(); add KittyKeyboardCapabilities
Terminal.Gui/Drivers/DriverImpl.cs Remove GetVersionInfo(), KittyKeyboardProtocol, SetKittyKeyboardProtocol; implement KittyKeyboardCapabilities
Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardProtocolResult.cs Rename to KittyKeyboardCapabilities
Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardProtocolDetector.cs Update return type
Terminal.Gui/Drivers/AnsiDriver/AnsiComponentFactory.cs Use IDriver.KittyKeyboardCapabilities
Terminal.Gui/App/MainLoop/MainLoopCoordinator.cs Update call site
Examples/UICatalog/UICatalogRunnable.cs Replace GetVersionInfo() with GetName()
Tests/.../KittyKeyboardProtocolDetectorTests.cs Update type references
Tests/.../MainLoopCoordinatorTests.cs Update property references

Activity

  1. added a commit that references this issue on Apr 11, 2026
    e532d61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions