TermBuf::Capability
Inherits Enum < Comparable < Value < Object
Stability: stable — changes only in a major release.
What the terminal on the other end can be asked to do.
Detection fills this in; the encoder only reads it. Anything not known to be supported is treated as unsupported, so a terminal nobody recognises gets plain text rather than a screen full of escape sequences.
This enum is append-only, and stays that way across major releases. A flags enum numbers its members by position, so inserting or reordering one silently renumbers every member after it, and a mask persisted or written down by bit value stops meaning what it meant. New capabilities go on the end, and a retired one keeps its place rather than being deleted.
Appending is therefore not a breaking change and can happen in a minor
release; the names, the numbering, and the snake case spellings
TERMBUF_CAPS accepts are what is frozen.
Constants
The eight colours of SGR 30-37 and 40-47.
The 256 colour palette, through SGR 38;5 and 48;5.
24 bit colour, through SGR 38;2 and 48;2.
The aixterm bright colour codes, SGR 90-97 and 100-107. Without this, palette indices 8 through 15 fall back to their dim counterparts, and a bright foreground picks up bold if bold is available.
SGR 4 and 24.
The 4:2 through 4:5 subparameter underline styles. Without this,
every underline style degrades to a plain one.
SGR 58 and 59, colouring the underline separately from the text.
DECSTBM and the SU/SD scroll commands, which is what lets a scrolled region be moved rather than redrawn.
IL and DL.
ECH, erasing a run of cells without writing spaces over them.
DEC private mode 2026, wrapping a paint so the terminal never shows a half-drawn frame.
The alternate screen buffer, DEC private mode 1049.
DEC private mode 2027, where the terminal measures text by grapheme cluster rather than by code point.
Measured only, never enabled. Turning the mode on changes how the terminal counts clusters, and the width probe measured this terminal with it off; enabling it afterwards would invalidate every width already established. Knowing whether the terminal has it is still worth having.
Detected but not in any preset: Prober asks for it with DECRQM and
TERMBUF_CAPS=+grapheme_clusters sets it by hand, but no member of
Capabilities below carries it, because which terminals answer yes has
not been measured across enough of them to write down. A mask built from
Capabilities::MODERN rather than from detection will not have it.
OSC 52, reading and writing the system clipboard through the terminal.
Detected but not in any preset, for the same reason as
GraphemeClusters and a different mechanism: OSC 52 answers nothing on
a write, so there is no query to ask and detection is
EnvironmentDetector's table of terminals that document it. That table
is what will grow; Capabilities::MODERN stays out of it, since a
terminal being modern says nothing about whether it will touch the
clipboard.