Stanza: dependency-free line editing for Zig terminal programs
I wrote a small line editor for Zig terminal applications:
It is meant for CLIs that need more than a basic readLine, but do not want to depend on readline, linenoise, libc, or another terminal library.
It supports history, completion, hints, syntax highlighting, bracketed paste, password input, vi/emacs-style editing, async output above the prompt, and both blocking and event-loop driven APIs.
A few design choices:
- allocator-explicit and instance-based
- no global editor state
- runtime-configurable callbacks for completion, hints, and highlighting
- UTF-8/display-width aware, but not a full grapheme-cluster editor
- tested on Linux, macOS, and Windows
I would be interested in feedback on the API shape and on whether the terminal handling looks reasonable/idiomatic.
Supported Zig versions
Currently Zig 0.16.0.
AI / LLM usage disclosure
I used AI assistance while writing parts of the code, tests, and documentation. I reviewed and tested the implementation myself, and I maintain the repository.