Class TerminalCapabilities
- Namespace
- SharpConsoleUI.Helpers
- Assembly
- SharpConsoleUI.dll
Detects terminal rendering capabilities at runtime. Probed once during driver initialization; results are cached for the session.
public static class TerminalCapabilities
- Inheritance
-
TerminalCapabilities
- Inherited Members
Properties
IsRemoteSession
Whether the session looks remote (SSH_TTY or SSH_CONNECTION set).
public static bool IsRemoteSession { get; }
Property Value
IsScreen
Whether running under GNU screen (STY set). OSC 52 is unreliable here.
public static bool IsScreen { get; }
Property Value
IsTmux
Whether running under tmux (TMUX set). OSC 52 must be passthrough-wrapped.
public static bool IsTmux { get; }
Property Value
SupportsKittyGraphics
Whether the terminal supports the Kitty graphics protocol for image display. Defaults to false until probed.
public static bool SupportsKittyGraphics { get; }
Property Value
SupportsOsc52
Whether OSC 52 clipboard writes should be attempted. Defaults to true unless under screen. An explicit override (see SetOsc52Override(bool?)) wins.
public static bool SupportsOsc52 { get; }
Property Value
SupportsUnicode16Widths
Whether the terminal renders Unicode 16.0 newly-widened characters (e.g. U+2630 โฐ trigrams) as 2 columns. When false, these characters are treated as width 1 (Unicode 15.0 behavior). Defaults to false (most terminals haven't adopted Unicode 16.0 widths yet).
public static bool SupportsUnicode16Widths { get; }
Property Value
SupportsVS16Widening
Whether the terminal renders emoji+VS16 (U+FE0F) as 2 columns. When false, VS16 is ignored by the terminal and emoji stay width 1. Defaults to true (modern terminal assumption) until probed.
public static bool SupportsVS16Widening { get; }
Property Value
SupportsZwjLigation
Whether the terminal renders a ZWJ emoji sequence (e.g. ๐จโ๐ฉโ๐งโ๐ฆ) as a SINGLE 2-column glyph rather than as its component emoji side by side. Modern terminals ligate ZWJ sequences; some legacy terminals draw each component separately. Defaults to true (modern assumption) until probed via Probe(Action<string>, Func<int>). Note: ZWJ-cluster width is inherently terminal-dependent โ there is no universally-correct value; the probe makes the library match the actual terminal.
public static bool SupportsZwjLigation { get; }
Property Value
Methods
Probe(Action<string>, Func<int>)
Probes the terminal to determine rendering capabilities. Tests VS16 emoji widening and Unicode 16.0 width changes. Must be called after raw mode is entered and before input loops start.
public static void Probe(Action<string> write, Func<int> readByte)
Parameters
writeAction<string>Action to write escape sequences to the terminal.
readByteFunc<int>Function to read a single byte from stdin with timeout. Returns -1 on timeout or error.
SetKittyGraphics(bool)
Allows manual override of the Kitty graphics capability. Useful for testing or when the terminal is known ahead of time.
public static void SetKittyGraphics(bool supported)
Parameters
supportedbool
SetOsc52Override(bool?)
Forces OSC 52 support on/off, or pass null to restore auto-detection.
public static void SetOsc52Override(bool? value)
Parameters
valuebool?
SetUnicode16Widths(bool)
Allows manual override of the Unicode 16.0 width capability. Useful for testing or when the terminal is known ahead of time.
public static void SetUnicode16Widths(bool supported)
Parameters
supportedbool
SetVS16Widening(bool)
Allows manual override of the VS16 widening capability. Useful for testing or when the terminal is known ahead of time.
public static void SetVS16Widening(bool supported)
Parameters
supportedbool