AlacrittyRenderer - VTE Parsing
The AlacrittyRenderer wraps Alacritty’s battle-tested VTE parser to process ANSI escape sequences with fast native performance.Overview
Why Alacritty?
| Aspect | xterm.js Parser | Alacritty Parser |
|---|---|---|
| Language | JavaScript | Rust |
| Performance | Interpreted | Native |
| Memory | GC overhead | Zero-copy |
| Test Coverage | Good | Excellent (1000+) |
| ANSI Support | Standard | Extensive |
| CJK Support | Basic | Full |
Core Components
AlacrittyRenderer
Wrapper aroundalacritty_terminal::Term:
AtomicParser
Detects BSU/ESU (Begin/End Synchronized Update) sequences:CellConverter
Converts Alacritty cells to xterm.js format:GridUpdate Structure
The output of AlacrittyRenderer:Dirty Tracking
Only emit changed lines for efficiency:Wide Character Handling
CJK characters (한글, 日本語, 中文) occupy 2 cells:Performance Characteristics
| Operation | Description |
|---|---|
| VTE parsing | Fast native Rust processing |
| Cell conversion | Direct format conversion |
| Dirty tracking | Efficient change detection |
| Overall | Faster than JavaScript parser |
Key Files
| File | Lines | Purpose |
|---|---|---|
alacritty_renderer.rs | ~599 | Term wrapper, dirty tracking |
atomic_parser.rs | ~764 | BSU/ESU detection |
cell_converter.rs | ~416 | Alacritty→xterm conversion |
SMPC/OFAC Applied
| Principle | Application |
|---|---|
| SMPC | Single purpose: VTE parsing only |
| Clean interface: process() → GridUpdate | |
| No rendering logic (that’s xterm’s job) | |
| OFAC | Dirty tracking emerged from performance need |
| AtomicParser emerged from BSU/ESU requirement | |
| Cell format emerged from xterm.js internals |