$ show kkawakam/rustyline
rustyline is a mature Rust library providing GNU Readline-style interactive line editing for terminal applications. It is not a standalone application but a reusable dependency used by CLIs, REPLs, and shells. The core is an Editor generic over helper and history types, with pluggable traits for completion, hints, highlighting, validation, and custom key bindings. It supports Emacs and Vi keymaps, Unicode/grapheme-aware editing, multi-line input, kill ring, undo/redo, and multiple history backends including in-memory, file, and SQLite. The architecture is trait-driven and platform-aware, with separate Unix and Windows TTY implementations behind a common abstraction, plus a derive macro crate to reduce boilerplate for custom helpers.
The LLM identified 5 files worth highlighting for reuse:
A self-contained line editing buffer that handles grapheme-aware cursor movement, insertion, deletion, and text manipulation. It demonstrates careful handling of Unicode segmentation and can be extracted for any editor or terminal input widget.
Implements a kill ring with append/prepend and yank/pop semantics, mirroring Emacs behavior. The logic is isolated and reusable in any text editing context, not just rustyline.
Provides a Changeset-based undo/redo mechanism that groups edits into reversible operations. It is a clean, self-contained implementation of a common editor requirement and could be reused independently.
Defines the Completer trait, Candidate model, and a FilenameCompleter, plus a longest_common_prefix utility. The trait abstraction and LCP logic are reusable for any tab-completion system.
Implements the History trait with in-memory and file-backed backends, including search and anchored search. The trait design cleanly separates storage from editing logic and can be adapted to other history-driven UIs.