Skip to main content

Module terminal_capabilities

Module terminal_capabilities 

Source
Expand description

Canonical terminal capability probe.

VT Code paints box-drawing chrome in more than one surface (the CLI transcript, the TUI panels, the modal lists) and each surface used to answer “can this terminal draw Unicode?” on its own. Those answers disagreed, so the same machine could render Unicode chrome in one surface and ASCII chrome in another.

This module owns the single answer: one probe, one verdict, evaluated once per process. The verdict is a deterministic fallback ladder:

  1. VTCODE_NO_UNICODE set to an affirmative value drops straight to ASCII.
  2. A terminal that advertises Unicode (TERM), or a UTF-8 locale, earns Unicode box drawing.
  3. A terminal known to render the dashed box-drawing variants correctly earns the rich tier.
  4. Everything else stays on ASCII, which never renders as mojibake.

The probe never guesses from the terminal name alone: iTerm2, WezTerm, and Hyper all advertise TERM=xterm-256color, so TERM_PROGRAM is the signal that identifies them.

Structs§

TerminalEnv
Terminal environment inputs the capability probe reads.

Enums§

BoxGlyphTier
Richness of the box-drawing chrome the terminal can render.

Functions§

box_glyph_tier
Whether the environment advertises Unicode box-drawing support.
box_glyph_tier_for
Evaluate the capability ladder against a captured environment.