Skip to main content

Module term_query

Module term_query 

Source
Expand description

Terminal graphics capability + cell-pixel-size detection. The response PARSERS here are pure and unit-tested; the I/O round-trip in detect is verified manually (no PTY tests, per project policy).

Structs§

TermGraphics
What the terminal supports, plus its cell pixel size when reported.

Functions§

detect
Probe the terminal for graphics support. Writes the query sequences to /dev/tty, reads the response with a short deadline, and parses it. Falls back to environment heuristics when the round-trip yields nothing. Pure ASCII (no support) is represented by an all-false TermGraphics.
env_fallback
Best-effort capability guess from environment variables, used when the active query times out (e.g. inside some terminal multiplexers).
parse_responses
Parse a batch of terminal query responses (raw bytes) into capabilities. Looks for: Kitty ESC _ G ... ; OK ESC \, a DA1 ESC [ ? <attrs> c whose attribute list contains 4 (Sixel), and a cell-size report ESC [ 6 ; <h> ; <w> t.