extui: Exrok's Minimal Unix TUI Crate
extui provides powerful primitives and low-level access for terminal interfaces tighly integrated together in a single crate.
extui was largly made for my own needs and is used some of my other projects such as:
Example
use GlobalWakerConfig;
use ;
use ;
Deliberate Limitations
extui intentionally omits certain features. This results in simpler interfaces and better performance:
| Limitation | Rationale |
|---|---|
| 8-bit color only | No 24-bit true color. The 256-color palette covers most use cases with simpler encoding. |
| 4-byte grapheme limit | Characters exceeding 4 bytes are truncated. Enables fixed-size Cell storage. |
| Unix only | No Windows support. Allows direct POSIX APIs without abstraction overhead. |
Inspirations
extui draws inspiration from excellent crates in the Rust terminal ecosystem while pursuing different tradeoffs.
ratatui
The lower-level buffer API designs are influenced by ratatui, with the following differences:
- New diffing algorithm: Generates VT rendering bytes directly in a greedy single-pass fashion, rather than computing diffs separately.
- Smaller diffs: Smarter about style transitions and leverages advanced VT escape sequences when possible, such as clearing whole lines to fill spaces.
- Compact Cell storage: The core
Cellabstraction is 8 bytes by default, packed into a singleu64for trivial diffing and cache-friendly iteration.
crossterm
Terminal input events and parsing are inspired by crossterm. extui improves on this foundation:
- Compact KeyEvent:
KeyEventis only 8 bytes, fitting inside a single CPU register. - Linear parsing: The event parser was optimized from O(n²) to O(n).