Expand description
Syntax highlighting for the source + instruction panes.
Backed by syntect (Sublime-syntax engine, used by bat, delta,
gitui) with [two-face] for grammar coverage.
No tokenizer or grammar is implemented here — we don’t ship any custom
parsing logic.
two-face doesn’t yet ship a SBPF grammar. We use its bundled
GAS-assembly syntax for the disassembly pane: it correctly colors
registers (r0-r11), immediates (0x..., decimals), labels,
brackets, and ; comments. SBPF mnemonics like mov64 / lddw /
ja aren’t in GAS’s keyword set, so they render in the default
foreground — acceptable, and we keep the option open to swap in a
dedicated SBPF syntax later without changing call sites.
Functions§
- detect_
theme_ mode_ once - Probe the terminal once for its background color and cache the result. Call this exactly once, before the ratatui terminal guard takes over stdout. Idempotent: subsequent calls are no-ops.
- highlight_
asm - Highlight one line of disassembly. Falls back to the plain-text syntax if no asm grammar resolved.
- highlight_
rust - Highlight one line of Rust source. Returns an owned
Lineof styled spans suitable for handing toratatui::widgets::Paragraph::new.