struct

TermBuf::Capabilities

Inherits Struct < Value < Object

Stability: stable — changes only in a major release.

A capability mask that keeps itself consistent.

Support is capped, not limited: a terminal that can do 24 bit colour can also do the 256 colour palette and the original sixteen, so setting the broader capability implies the narrower ones. The encoder relies on that, and checks only the capability it is about to use.

Constants

ANSI = new(((((((Capability::Color16 | Capability::Bold) | Capability::Underline) | Capability::Reverse) | Capability::Blink) | Capability::ScrollRegion) | Capability::InsertDeleteLine) | Capability::AltScreen)

What essentially every terminal emulator written since the 1980s does.

MODERN = new(((((((((((XTERM.flags | Capability::TrueColor) | Capability::ExtendedUnderline) | Capability::UnderlineColor) | Capability::Overline) | Capability::SynchronizedOutput) | Capability::BracketedPaste) | Capability::FocusEvents) | Capability::MouseSgr) | Capability::Osc8Links) | Capability::Titles) | Capability::CursorShape)

A current terminal such as kitty, ghostty, or WezTerm.

No RapidBlink. SGR 6 is one of the least implemented codes there is — kitty draws nothing at all for it, where SGR 5 blinks — and this shard assumes a capability absent without a reason to believe otherwise. The encoder steps a rapid blink down to an ordinary one rather than dropping it, so asking for it still blinks; a terminal measured doing better can be given the flag by name. No Osc52Clipboard or GraphemeClusters either, for the reasons given on those two: both are detected, neither is presumed from a terminal being modern.

FocusEvents, MouseSgr, Titles and CursorShape were the four here that nothing had ever watched: each reached a terminal by way of a table of names, and a name is a statement about a family. All four were watched working on 2026-09-10, on ghostty 1.3.2, kitty 0.48.2 and iTerm2 3.6.11 — a focus report on the way out and back in, a click reported, the window renamed, the cursor's shape changed — so all four stay. What the same readings did change is where a multiplexer or Terminal.app is concerned; see measurements/CAPS.md and EnvironmentDetector.

NONE = new

Nothing at all: plain text, no escape sequences. The starting point for detection, and what an unrecognised terminal gets.

XTERM = new(((((((ANSI.flags | Capability::Color256) | Capability::BrightColors) | Capability::Italic) | Capability::Faint) | Capability::Strike) | Capability::Conceal) | Capability::EraseChars)

A typical xterm-256color terminal.

Constructors

new(flags : Capability = Capability::None)

A mask carrying flags and everything they imply. See .normalize, and NONE, ANSI, XTERM and MODERN for the presets.

Source

Class methods

normalize(flags : Capability) : Capability

Applies the implications a capability carries with it.

Source

Instance methods

flags

The mask itself, already normalized.

Source
includes?(capability : Capability) : Bool

Whether every capability in capability is present.

Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
with(capability : Capability) : Capabilities

Adds a capability along with everything it implies, so that setting TrueColor also sets Color256 and Color16.

Source
without(capability : Capability) : Capabilities

Removes a capability along with everything that implies it, so that clearing Color256 also clears TrueColor rather than leaving a mask that claims both.

Source