Back to Projects
TUIX v0.6Beta

Last Updated: 2026-08-14

Terminal Probing & Capability Negotiation

TUIX v0.6 introduces active terminal probing to determine emulator capabilities before starting the render loop. Because terminal emulators vary widely in their handling of wide characters, RGB truecolor, cursor query responses, and escape codes, probing enables TUIX to select the optimal rendering strategy automatically.

Probing Lifecycle

  1. `tuix_terminal_prepare()`: Switches terminal to raw mode, enables alternate screen buffer, and disables local echo.
  2. `tuix_terminal_probe()`: Sends specialized Device Status Report (DSR) and cursor query escape sequences to measure response latency, terminal dimensions, and capability flags.
  3. `tuix_terminal_select_policy()`: Evaluates probe results and selects glyph fallback policies (e.g. enabling full Unicode or falling back to safe ASCII borders).
  4. `tuix_terminal_restore()`: Cleans up terminal state, restores cursor visibility, and exits the alternate screen buffer on application exit.

Probe Modes & Configuration

Setting / ModeFunctionDescription
Strict Probe Modetuix.tuix_terminal_config_set_probe_mode(0)Full query sequence with validation of DSR cursor responses.
Fast Probe Modetuix.tuix_terminal_config_set_probe_mode(1)Shortened timeout probe prioritizing startup speed.
ASCII Fallbacktuix.tuix_terminal_config_set_ascii_fallback(True)Forces safe ASCII box-drawing characters (`+`, `-`, `|`) instead of Unicode box glyphs.
from tuix.core import tuix

# Configure probe policy
tuix.tuix_terminal_config_ensure_defaults()
tuix.tuix_terminal_config_set_ascii_fallback(False)

# Run active probing
tuix.tuix_terminal_prepare()
tuix.tuix_terminal_probe()
tuix.tuix_terminal_select_policy()

# Inspect detected terminal capabilities
info = tuix.tuix_terminal_get_info()
print('Terminal Info:', info)