Skip to content

fix: harden terminal probes across platforms - #311

Merged
subinium merged 1 commit into
mainfrom
feature/terminal-compatibility
Jul 31, 2026
Merged

fix: harden terminal probes across platforms#311
subinium merged 1 commit into
mainfrom
feature/terminal-compatibility

Conversation

@subinium

@subinium subinium commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • restrict automatic terminal capability probes to identified direct terminal emulators
  • skip query traffic for non-TTY streams, TERM=dumb, and tmux/screen unless explicitly forced
  • add SLT_FORCE_TERMINAL_QUERIES and SLT_DISABLE_TERMINAL_QUERIES overrides
  • emit Kitty keyboard push/pop sequences directly so crossterm's legacy Windows API cannot abort terminal cleanup
  • make optional Windows console-mode teardown best-effort so cursor, paste, and alternate-screen restoration always continues
  • make the run_static signature regression test compile-only so it never opens a live terminal under a PTY test runner
  • add blocking macOS and Windows test jobs to both pull-request CI and the release gate
  • document the query policy and record the changes under Unreleased

Why

A real-PTY run exposed two compatibility hazards: a compile-signature test could emit terminal query sequences, and a silent or generic PTY host could leave the reply pump racing the first byte of user input. Automatic probing now requires a direct-terminal identity, while environment fallbacks remain available without terminal I/O.

The first Windows CI run exposed a separate cleanup bug: crossterm 0.28 reports Kitty keyboard commands as unsupported through its legacy Windows API. The next run exposed that mouse cleanup can also report Initial console modes not set when panic cleanup has no initialized session. Either error previously returned before focus, bracketed paste, cursor, and alternate-screen cleanup ran. SLT now writes the standard Kitty ANSI protocol bytes directly and treats optional console-mode teardown as best-effort while preserving core restoration.

Validation

  • cargo fmt -- --check
  • cargo check --all-features
  • cargo clippy --all-features -- -D warnings
  • cargo test --all-features (847 core unit tests plus integration and doctests)
  • cargo check --examples --all-features
  • typos
  • cargo check -p superlighttui --no-default-features
  • cargo check -p slt-wasm --target wasm32-unknown-unknown
  • cargo hack check -p superlighttui --each-feature --no-dev-deps (29 combinations)
  • cargo audit (1,174 advisories loaded, no vulnerabilities)
  • cargo deny check
  • cargo check -p superlighttui --features full,pty-test --target x86_64-pc-windows-gnu
  • real PTY smoke tests for TERM=dumb and an unidentified generic xterm-256color host; no query/control bytes were emitted
  • workflow YAML parsed successfully

Release note

This is an Unreleased post-v0.22.3 hardening change. It does not retag or mutate the published v0.22.3 artifact.

@subinium
subinium force-pushed the feature/terminal-compatibility branch from 46de038 to 32e6c72 Compare July 31, 2026 06:23
@subinium
subinium force-pushed the feature/terminal-compatibility branch from 32e6c72 to 3e1468c Compare July 31, 2026 06:30
@subinium
subinium merged commit aa7e3bc into main Jul 31, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant