rpi-tui 0.3.4

Terminal User Interface for pi-rust
Documentation

rpi-tui

crates.io docs.rs

The terminal UI primitives behind the rpi interactive agent: a component model, layout containers, an editor, transcript rendering, and both fullscreen and main-screen terminal modes.

This is the rendering layer, not an extension point. Agents extend rpi by registering tools and event handlers (see rpi-plugin-sdk), and the CLI decides how to draw them.

Install

[dependencies]
rpi-tui = "0.3"

Built on crossterm; no async runtime required.

What is here

Area Types
Component model Component, Focusable, Container, VStack, HStack, Box, Spacer
Text and layout Text, StackEntry, StackChild, FollowMode, width-aware wrapping
Input Editor, EditorOptions, EditorStyle, Input, keybindings, KillRing
Transcript AssistantMessageComponent, BashExecutionComponent, diff::render_diff
Markdown markdown, syntax_highlight, latex, mermaid
Selection SelectList, SearchableSelect, AltScreenSearch, fuzzy
Terminal ProcessTerminal, TuiAltScreen, TerminalInfo, terminal_image

Two screen modes

  • Fullscreen (alternate screen) — the application owns the viewport and paints a constrained layout. The default on Windows and Linux.
  • Main screen — the terminal keeps ownership of scrollback and text selection, and the app redraws only changed lines. The default on macOS, so native selection and scrollback keep working.

The CLI exposes the choice as --tui-mode regular|fullscreen.

Rendering model

A component returns the lines it wants drawn at a given width:

use rpi_tui::Component;

pub trait Component: Send + Sync {
    fn render(&self, width: usize) -> Vec<String>;

    /// Return `true` if the key sequence was consumed.
    fn handle_input(&self, _data: &str) -> bool {
        false
    }
}

The renderer diffs that against the previous frame and emits only the changed line range. Unchanged frames produce no output at all, which is what keeps a background status tick from yanking the viewport back to the bottom of a main-screen session.

Running the example

cargo run -p tui

Interactive demo with a scrollable transcript, an editor and keyboard navigation — the source is at examples/tui.

Documentation

License

MIT. See LICENSE and NOTICE.