Expand description
Terminal User Interface for pi-rust
This crate provides a TUI system similar to the TypeScript implementation
in packages/tui/. It supports:
- Main screen mode (terminal scrollback)
- Alternate screen mode (fullscreen with constrained layout)
- Component-based UI with VStack, HStack, ScrollView
- Mouse and keyboard input handling
- Image support (Kitty/iTerm2 protocols)
- Autocomplete, search, and more
Re-exports§
pub use alt_screen_search::AltScreenSearch;pub use alt_screen_search::SearchMatch;pub use alt_screen_search::SearchState;pub use ansi::bold;pub use ansi::strip_ansi;pub use ansi::visible_width;pub use ansi::CURSOR_MARKER;pub use assistant_message::AssistantBlock;pub use assistant_message::AssistantMessageComponent;pub use assistant_message::AssistantMessageOptions;pub use autocomplete::AutocompleteItem;pub use autocomplete::AutocompleteManager;pub use autocomplete::AutocompleteProvider;pub use autocomplete::AutocompleteSuggestions;pub use autocomplete::CombinedAutocompleteProvider;pub use autocomplete::FilePathAutocompleteProvider;pub use autocomplete::SlashCommand;pub use autocomplete::SlashCommandAutocompleteProvider;pub use bash_execution::BashExecutionComponent;pub use bash_execution::BashStatus;pub use bash_execution::BashTruncation;pub use bordered_loader::BorderedLoader;pub use bordered_loader::BorderedLoaderInner;pub use box_component::Box;pub use component::Component;pub use component::Focusable;pub use container::Container;pub use countdown_timer::CountdownTimer;pub use diff::render_diff;pub use dynamic_border::DynamicBorder;pub use editor::Editor;pub use editor::EditorOptions;pub use editor::EditorStyle;pub use editor::WorkingState;pub use fuzzy::fuzzy_filter;pub use fuzzy::fuzzy_match;pub use fuzzy::FuzzyMatch;pub use hstack::HStack;pub use image::Image;pub use image::ImageOptions;pub use image::ImageTheme;pub use input::Input;pub use keybinding_hints::format_combo;pub use keybinding_hints::key_code_name;pub use keybinding_hints::key_display_text;pub use keybinding_hints::key_hint;pub use keybinding_hints::key_text;pub use keybinding_hints::raw_key_hint;pub use keybindings::get_keybindings;pub use keybindings::set_keybindings;pub use keybindings::KeyCombo;pub use keybindings::KeybindingConflict;pub use keybindings::KeybindingDefinition;pub use keybindings::KeybindingId;pub use keybindings::Keybindings;pub use keys::is_key_release;pub use keys::is_key_repeat;pub use keys::is_kitty_protocol_active;pub use keys::matches_key;pub use keys::parse_key;pub use keys::set_kitty_protocol_active;pub use keys::Key;pub use keys::KeyEventType;pub use keys::KeyHelper;pub use keys::KeyId;pub use kill_ring::KillRing;pub use kill_ring::PushOptions;pub use latex::is_latex;pub use latex::render_latex;pub use latex::strip_latex;pub use latex::RenderLatexOptions;pub use layout::composite_tui_line;pub use layout::extract_cursor_position;pub use layout::hit_test;pub use layout::render_layout_frame;pub use layout::LayoutBox;pub use layout::LayoutFrame;pub use layout::LayoutRect;pub use layout_node::allocate_stack_sizes;pub use layout_node::LayoutNode;pub use layout_node::LayoutNodeProvider;pub use layout_node::LayoutViewport;pub use layout_node::StackLayoutEntry;pub use loader::CancellableLoader;pub use loader::Loader;pub use loader::LoaderIndicatorOptions;pub use loader::ProgressLoader;pub use loader::SPINNER_FRAMES;pub use loader::SPINNER_FRAME_MS;pub use markdown::Markdown;pub use markdown::MarkdownOptions;pub use mermaid::Mermaid;pub use overlay::Dialog;pub use overlay::OverlayHandle;pub use overlay::OverlayManager;pub use overlay::Selector;pub use overlay::SelectorItem;pub use scroll_view::FollowMode;pub use scroll_view::ScrollView;pub use scroll_view::ScrollViewOptions;pub use search_bar::SearchBar;pub use searchable_select::SearchableSelectList;pub use select_list::SelectItem;pub use select_list::SelectList;pub use select_list::SelectListLayoutOptions;pub use select_list::SelectListTheme;pub use settings_list::SettingItem;pub use settings_list::SettingType;pub use settings_list::SettingsList;pub use settings_list::SettingsListTheme;pub use spacer::Spacer;pub use status_indicator::CompactionReason;pub use status_indicator::IdleStatus;pub use status_indicator::StatusIndicator;pub use status_indicator::StatusKind;pub use stdin_buffer::StdinBuffer;pub use stdin_buffer::StdinBufferEvent;pub use stdin_buffer::StdinBufferOptions;pub use terminal::InputEvent;pub use terminal::ProcessTerminal;pub use terminal::Terminal;pub use terminal::TerminalError;pub use terminal::TerminalInfo;pub use terminal_colors::parse_osc11_background_color;pub use terminal_colors::parse_terminal_color_scheme_report;pub use terminal_colors::query_background_color;pub use terminal_colors::query_color_scheme;pub use terminal_colors::query_cursor_color;pub use terminal_colors::query_foreground_color;pub use terminal_colors::RgbColor;pub use terminal_colors::TerminalColorScheme;pub use terminal_image::allocate_image_id;pub use terminal_image::calculate_image_rows;pub use terminal_image::delete_all_kitty_images;pub use terminal_image::delete_kitty_image;pub use terminal_image::detect_capabilities;pub use terminal_image::encode_iterm2;pub use terminal_image::encode_kitty;pub use terminal_image::get_capabilities;pub use terminal_image::get_cell_dimensions;pub use terminal_image::get_gif_dimensions;pub use terminal_image::get_image_dimensions;pub use terminal_image::get_jpeg_dimensions;pub use terminal_image::get_png_dimensions;pub use terminal_image::get_webp_dimensions;pub use terminal_image::hyperlink;pub use terminal_image::image_fallback;pub use terminal_image::render_image;pub use terminal_image::reset_capabilities_cache;pub use terminal_image::set_capabilities;pub use terminal_image::set_cell_dimensions;pub use terminal_image::CellDimensions;pub use terminal_image::ImageDimensions;pub use terminal_image::ImageProtocol;pub use terminal_image::ImageRenderOptions;pub use terminal_image::TerminalCapabilities;pub use text::Text;pub use theme::apply_theme_preset;pub use theme::global_theme_manager;pub use theme::theme;pub use theme::theme_revision;pub use theme::Color;pub use theme::Theme;pub use theme::ThemeColors;pub use theme::ThemeManager;pub use theme::ThemePreset;pub use tool_execution::ToolExecutionComponent;pub use tool_execution::ToolStatus;pub use truncated_text::TruncatedText;pub use tui::OverlayAnchor;pub use tui::OverlayHandle as TuiOverlayHandle;pub use tui::OverlayMargin;pub use tui::OverlayOptions;pub use tui::TuiMode;pub use tui::TuiStopOptions;pub use tui::TUI;pub use tui_alt_screen::is_viewport_tui;pub use tui_alt_screen::TuiAltScreen;pub use tui_alt_screen::VIEWPORT_TUI;pub use tui_main_screen::TuiMainScreen;pub use undo_stack::RedoStack;pub use undo_stack::UndoRedoManager;pub use undo_stack::UndoStack;pub use user_message::UserMessageComponent;pub use utils::apply_background_to_line;pub use utils::get_grapheme_segmenter;pub use utils::get_osc8_link_at_column;pub use utils::is_whitespace_char;pub use utils::slice_by_column;pub use utils::truncate_to_width;pub use utils::visible_width as visible_width_util;pub use utils::wrap_text_with_ansi;pub use utils::Grapheme;pub use utils::GraphemeSegmenter;pub use visual_truncate::truncate_to_visual_lines;pub use visual_truncate::VisualTruncateResult;pub use vstack::layout_vstack_constrained;pub use vstack::StackAlign;pub use vstack::StackChild;pub use vstack::StackEntry;pub use vstack::StackEntryOptions;pub use vstack::StackOptions;pub use vstack::VStack;pub use word_navigation::find_line_end;pub use word_navigation::find_line_start;pub use word_navigation::find_word_backward;pub use word_navigation::find_word_end;pub use word_navigation::find_word_forward;pub use word_navigation::get_current_word_range;pub use word_navigation::is_at_word_end;pub use word_navigation::is_at_word_start;pub use word_navigation::is_word_boundary;pub use word_navigation::is_word_char;
Modules§
- alt_
screen_ search - Alt screen search functionality.
- ansi
- ANSI escape code utilities and visible width calculations.
- assistant_
message - Assistant message component for rendering AI responses.
- autocomplete
- Autocomplete support for TUI.
- bash_
execution - Bash execution component — streaming display port of
bash-execution.ts. - bordered_
loader - Loader wrapped in
DynamicBorders — port ofbordered-loader.ts. - box_
component - Box component - a container that applies padding and background to children.
- component
- Component trait and base types for TUI.
- container
- Container component that holds multiple child components.
- countdown_
timer - Deadline-based countdown timer.
- diff
- Diff rendering for tool results — colored
+/-/lines with intra-line word-diff highlighting. - dynamic_
border - Dynamic border component — a horizontal rule that stretches to the viewport width.
- editor
- Editor component for multi-line text editing.
- footer
- Footer component for TUI.
- fuzzy
- Fuzzy matching utilities.
- hstack
- HStack - Horizontal stack layout component.
- image
- Image component for terminal display.
- input
- Input component - single-line text input with horizontal scrolling.
- keybinding_
hints - Keybinding hint formatting utilities.
- keybindings
- Keybinding system for TUI.
- keys
- Keyboard input handling for terminal applications.
- kill_
ring - Kill ring for Emacs-style kill and yank operations.
- latex
- LaTeX rendering support.
- layout
- Layout system for constrained rendering in TuiAltScreen.
- layout_
node - Layout node system for exposing component layout structure.
- loader
- Loader component - loading indicator.
- markdown
- Markdown component for rendering markdown text.
- mermaid
- Compact Mermaid rendering for terminal TUI.
- overlay
- Overlay system for modal dialogs and selectors.
- render
- Rendering utilities for TUI.
- scroll_
view - ScrollView - Scrollable container component.
- search_
bar - Search bar component for transcript search.
- searchable_
select - Searchable select list — a titled select list with a fuzzy-filter input.
- select_
list - SelectList component - a selectable list with filtering.
- settings_
list - Settings list component.
- spacer
- Spacer component for adding empty space.
- status_
indicator - Status indicator components — port of
status-indicator.ts. - stdin_
buffer - Input buffering for batch splitting.
- syntax_
highlight - Lightweight code syntax highlighting for terminal rendering.
- terminal
- Terminal abstraction for TUI.
- terminal_
colors - Terminal color parsing and manipulation.
- terminal_
image - Terminal image support.
- text
- Text component for simple text rendering.
- theme
- Theme system for TUI customization.
- tool_
execution - Tool execution component for displaying tool calls.
- truncated_
text - Truncated text component.
- tui
- Base TUI trait and types.
- tui_
alt_ screen - TuiAltScreen - Alternate screen TUI with constrained layout.
- tui_
main_ screen - TuiMainScreen - Main screen TUI with terminal scrollback.
- undo_
stack - Undo stack for text editing.
- user_
message - User message component — port of
user-message.ts. - utils
- Utilities for TUI rendering.
- visual_
truncate - Visual-line truncation utility.
- vstack
- VStack - Vertical stack layout component.
- word_
navigation - Word navigation utilities for text editing.