Termisu::Terminfo
Inherits Reference / Object
Terminfo database interface for terminal capability management.
Provides access to terminal control sequences by loading capabilities from the system terminfo database with fallback to hardcoded values for common terminals (xterm, linux).
Loading Strategy
- Attempts to load capabilities from terminfo database at standard locations
- Falls back to built-in escape sequences for xterm/linux if database unavailable
- Merges database values with builtins, preferring database values
Usage
terminfo = Termisu::Terminfo.new
puts terminfo.clear_screen_seq # => "\e[H\e[2J"
puts terminfo.bold_seq # => "\e[1m"
Note: All capability methods return escape sequence STRINGS, not actions.
The _seq suffix indicates this clearly.
Constants
Constructors
Instance methods
True when every attribute-enable capability equals its standard ECMA-48 SGR sequence (byte-identical to the xterm/linux builtins). Set once during initialization and never mutated afterwards (fiber-safe). Exposed so Terminal's combined apply_sgr path only emits hardcoded SGR parameters when they match what the granular terminfo-driven path would produce; exotic TERMs with non-CSI attribute sequences fall back to that path.
Returns escape sequence to set background color.
Uses the terminfo setab capability with tparm processing.
Returns escape sequence to make cursor blink/very visible (cvvis). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to enable blink (blink). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to enable bold (bold). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to move cursor to column N (0-based).
True when the loaded cup capability equals STANDARD_CUP. Set once during
initialization and never mutated afterwards (fiber-safe). Exposed so
Terminal can stream CSI cursor moves directly (byte-identical to
cursor_position_seq output) without a per-move String.
Returns the raw cup capability string (parametrized).
Use cursor_position_seq to get a ready-to-use sequence with coordinates.
Uses cached value to avoid hash lookup overhead.
Returns escape sequence to move cursor backward N columns.
Returns escape sequence to move cursor forward N columns.
Returns escape sequence to move cursor to position (row, col).
Coordinates are 0-based and converted to 1-based by the %i operation in
the capability string. When the loaded cup is the standard ANSI
template, a direct-interpolation fast path is used (byte-identical to
tparm output); non-standard cup strings fall back to tparm processing.
Returns escape sequence to enable dim/faint mode (dim). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to set foreground color.
Uses the terminfo setaf capability with tparm processing.
Returns escape sequence to hide cursor (civis). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to insert N blank lines at cursor.
Returns escape sequence to enable italic/cursive mode (sitm). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to reset all attributes (sgr0). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to enable reverse video (rev). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to move cursor to row N (0-based).
Returns the raw setab capability string (parametrized background color). Uses cached value to avoid hash lookup overhead.
Returns the raw setaf capability string (parametrized foreground color). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to show cursor (cnorm). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to enable strikethrough mode (smxx). Uses cached value to avoid hash lookup overhead.
Returns escape sequence to enable underline (smul). Uses cached value to avoid hash lookup overhead.