Skip to main content

Module highlight

Module highlight 

Source
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 Line of styled spans suitable for handing to ratatui::widgets::Paragraph::new.