tui library TUI

Interactive TUI framework (Bubble Tea for Dart).

This library provides a framework for building interactive terminal applications using the Elm Architecture (Model-Update-View).

Core Components

  • Model: Represents the state of your application.
  • Update: A function that handles messages and returns a new model and commands.
  • View: A function that renders the current model into a string.
  • Program: The runtime that manages the event loop and rendering.
  • Bubbles: Reusable interactive widgets like text inputs, spinners, and lists.

Quick Start

import 'package:artisanal/tui.dart';

class CounterModel implements Model {
  final int count;
  CounterModel([this.count = 0]);

  @override
  Cmd? init() => null;

  @override
  (Model, Cmd?) update(Msg msg) {
    return switch (msg) {
      KeyMsg(key: Key(type: KeyType.up)) =>
        (CounterModel(count + 1), null),
      KeyMsg(key: Key(type: KeyType.down)) =>
        (CounterModel(count - 1), null),
      KeyMsg(key: Key(type: KeyType.runes, runes: [0x71])) =>
        (this, Cmd.quit()),
      _ => (this, null),
    };
  }

  @override
  String view() => 'Count: \$count\n\nUse ↑/↓ to change, q to quit';
}

void main() async {
  await runProgram(CounterModel());
}

The Elm Architecture

The TUI runtime follows The Elm Architecture (TEA) pattern, which separates state, logic, and presentation:

  • Model: The state of your application. It should be immutable.
  • Update: A pure function that takes a Msg and the current Model, and returns a new Model and an optional Cmd.
  • View: A pure function that takes the Model and returns a String (or a View object for advanced metadata) representing the UI.
┌─────────────────────────────────────────────────────┐
│                     Program                          │
│                                                      │
│    ┌───────┐     ┌────────┐     ┌──────┐            │
│    │ Model │────▶│ update │────▶│ view │            │
│    └───────┘     └────────┘     └──────┘            │
│        ▲              │              │               │
│        │              │              ▼               │
│        │         ┌────────┐     ┌────────┐          │
│        └─────────│  Cmd   │     │ Screen │          │
│                  └────────┘     └────────┘          │
│                       │                              │
│                       ▼                              │
│                  ┌────────┐                          │
│                  │  Msg   │◀──── User Input          │
│                  └────────┘                          │
└─────────────────────────────────────────────────────┘

Commands and Messages

  • Msg: Represents an event (key press, timer tick, network response).
  • Cmd: Represents an effect to be performed by the runtime (quitting, sending a message, running an external process).

Use BatchMsg to group multiple messages, Cmd.batch to run commands concurrently, and Cmd.sequence to run commands in order.

Program Lifecycle

  1. Initialization: The Program starts, calls Model.init(), and executes the returned Cmd.
  2. Event Loop: The program waits for input (stdin, signals, or commands).
  3. Update: When a Msg arrives, Model.update(msg) is called.
  4. Render: If the model changed, Model.view() is called and the result is rendered to the terminal.
  5. Termination: The program exits when a QuitMsg is received or Cmd.quit() is executed.

Rendering and Performance

Artisanal supports multiple rendering strategies:

  • Standard: Simple ANSI output for basic terminals.
  • Ultraviolet: High-performance diff-based rendering with cell buffers.
  • ANSI Compression: Minimizes output by removing redundant SGR sequences.

Configure these via ProgramOptions.

The TUI runtime follows The Elm Architecture (TEA) pattern, which separates state, logic, and presentation:

  • Model: The state of your application. It should be immutable.
  • Update: A pure function that takes a Msg and the current Model, and returns a new Model and an optional Cmd.
  • View: A pure function that takes the Model and returns a String (or a View object for advanced metadata) representing the UI.
┌─────────────────────────────────────────────────────┐
│                     Program                          │
│                                                      │
│    ┌───────┐     ┌────────┐     ┌──────┐            │
│    │ Model │────▶│ update │────▶│ view │            │
│    └───────┘     └────────┘     └──────┘            │
│        ▲              │              │               │
│        │              │              ▼               │
│        │         ┌────────┐     ┌────────┐          │
│        └─────────│  Cmd   │     │ Screen │          │
│                  └────────┘     └────────┘          │
│                       │                              │
│                       ▼                              │
│                  ┌────────┐                          │
│                  │  Msg   │◀──── User Input          │
│                  └────────┘                          │
└─────────────────────────────────────────────────────┘
  • Msg: Represents an event (key press, timer tick, network response).
  • Cmd: Represents an effect to be performed by the runtime (quitting, sending a message, running an external process).

Use BatchMsg to group multiple messages, Cmd.batch to run commands concurrently, and Cmd.sequence to run commands in order.

  1. Initialization: The Program starts, calls Model.init(), and executes the returned Cmd.
  2. Event Loop: The program waits for input (stdin, signals, or commands).
  3. Update: When a Msg arrives, Model.update(msg) is called.
  4. Render: If the model changed, Model.view() is called and the result is rendered to the terminal.
  5. Termination: The program exits when a QuitMsg is received or Cmd.quit() is executed.

Artisanal supports multiple rendering strategies:

  • Standard: Simple ANSI output for basic terminals.
  • Ultraviolet: High-performance diff-based rendering with cell buffers.
  • ANSI Compression: Minimizes output by removing redundant SGR sequences.

Configure these via ProgramOptions.

Classes

AdaptiveChromaTheme
An adaptive syntax highlighting theme that selects between light and dark variants based on terminal background.
AnsiRenderer
Renders markdown AST nodes to ANSI-styled terminal output.
AnsiRendererOptions
Configuration options for ANSI markdown rendering.
AppliedFileEdit
Result of applying one file's edits.
ArtisanalDevTools
DevTools integration for artisanal TUI programs.
AsyncSyntaxTreeProvider
Asynchronous backend interface for incremental syntax trees.
AsyncSyntaxTreeSession
Coordinates asynchronous tree builds and rejects stale responses.
AsyncTextSyntaxProvider<State>
Asynchronous syntax provider for parsers that run outside the render loop.
AsyncTextSyntaxSession<State>
Coordinates asynchronous syntax builds and rejects stale responses.
AttachmentPreview
Prepared pixel payload (or failure) for one attachment.
BackendTerminal
Terminal implementation that layers ANSI/OSC semantics over a TerminalBackend.
BackgroundColorMsg
Message containing the terminal's background color.
BackgroundColorProbe
Best-effort probe for terminal theme state before the first frame.
BatchMsg
Message containing multiple messages to be processed sequentially.
BrowserTerminalHostServer
Reusable browser host server for remote TUI sessions.
BufferedTuiRenderer
A renderer that buffers output for efficient writes.
CapabilityMsg
Message sent when a terminal capability is reported.
CapturedOutputModel
Optional interface for models that receive captured output automatically.
CapturedOutputMsg
Message sent when a print() or stderr write is intercepted by the output-capture system.
CellSizeMsg
Message sent when the terminal reports its cell size in pixels.
ChromaTheme
Configuration for syntax highlighting colors.
ClearScreenMsg
Internal message to clear the screen.
ClipboardMsg
Clipboard content message.
ClipboardSetMsg
Message emitted after a best-effort clipboard write is attempted.
Cmd TUI
A command that produces a message asynchronously.
ColorPaletteMsg
Message containing a terminal palette entry color.
ColorProfileMsg
Message sent when the terminal color profile is detected or changed.
ColorSchemeMsg
Message sent when the terminal reports its preferred light/dark scheme.
CommandPaletteController
Shared query, ranking, selection, and viewport controller.
CommandPaletteItem
A portable command-palette item, independent of any widget framework.
CommandPaletteMatch
A scored palette match with deterministic ranking evidence.
CommandPaletteWindow
Inclusive-exclusive window of filtered items that should stay on screen.
CommonKeyBindings
Commonly used key bindings for navigation.
CompositeModel
A model that wraps another model, useful for composition.
CursorColorMsg
Message containing the terminal's cursor color.
CursorPositionMsg
Message sent when the terminal reports the cursor position.
CustomMsg<T>
Message wrapper for custom user-defined messages.
DevToolsMessageEntry
A recorded message dispatch entry for the message log.
DevToolsRenderStats
Render timing statistics accumulated over the program lifetime.
DisableBracketedPasteMsg
Internal message to disable bracketed paste.
DisableMouseMsg
Internal message to disable mouse tracking.
DisableReportFocusMsg
Internal message to disable focus reporting.
DisplayNumberAssigner
Monotonic display-number assigner; reset when the prompt clears.
EditBuffer
EditConflict
Two edits in one file whose ranges overlap.
EditHistoryCheckpoint<Action, State, Marker>
EditHistoryController<Action, State, Marker>
EditorCodeAction
A quick fix, refactor, or source action offered by tooling.
EditorCodeActionProvider
Supplies code actions without coupling editor core to LSP or FFI.
EditorCodeActionRequest
Context passed to a backend-neutral code-action provider.
EditorCodeActionSession
Rejects results superseded by another request or explicit cancellation.
EditorCommand<T>
A stable, discoverable editor operation.
EditorCommandIds
Stable IDs for commands shared by editor hosts.
EditorCommandPalette<T>
UI-agnostic state for an editor command palette.
EditorCommandRegistry<T>
Ordered registry of stable editor commands.
EditorCommentConfig
Versatile language abstraction for the editor core.
EditorCompletionItem
One completion candidate and the edits needed to accept it.
EditorCompletionProvider
Backend-neutral source of editor completions.
EditorCompletionRequest
Immutable completion request in grapheme/document coordinates.
EditorCompletionResult
Result returned by an EditorCompletionProvider.
EditorCompletionSession
Coordinates asynchronous completion requests and rejects stale responses.
EditorCoreConfig
EditorDocumentSnapshot
Serializable editor document state supplied to persistence adapters.
EditorDocumentStore
Persistence boundary for files, databases, browser storage, or remote APIs.
EditorIndentContext
Indent request passed to a language adapter.
EditorKeyBinding
Associates a host-normalized key chord with a command.
EditorKeymap
Ordered keymap with conflict detection.
EditorLanguageAdapter
Adapter that customizes editing behavior per language.
EditorLanguageRegistry
Mutable registry mapping language identifiers to adapters.
EditorPairConfig
Bracket/pair configuration for a language.
EditorPersistenceSession
Coordinates durable saves and recovery while rejecting stale completions.
EditorSelection
External editor selection attached to a prompt.
EditorSelectionPosition
IDE selection ingestion for prompt composers.
EditorSelectionRange
One selected range inside EditorSelection.filePath.
EditorSortLinesArgument
Options supplied to the argument-taking sortSelectedLines command.
EditorState
EditorSyntaxCapture
A query capture mapped to a decoration style.
EditorSyntaxNode
Pure-Dart syntax-tree DTOs for Tree-sitter-style backends.
EditorSyntaxTree
Immutable snapshot of a parsed syntax tree.
EditorWorkAssessment
Feature recommendations derived from an EditorWorkBudget.
EditorWorkBudget
Configurable limits for features whose cost grows with document size.
EditorWrapSelectionArgument
Delimiters supplied to the argument-taking wrapSelection command.
EmbeddedTerminalBackend
Generic embedded backend backed by callbacks and externally supplied streams.
EmojiWidthProbe
Best-effort probe to align emoji cell width with the active terminal.
EnableBracketedPasteMsg
Internal message to enable bracketed paste.
EnableMouseAllMotionMsg
Internal message to enable mouse all motion tracking.
EnableMouseCellMotionMsg
Internal message to enable mouse cell motion tracking.
EnableReportFocusMsg
Internal message to enable focus reporting.
EnterAltScreenMsg
Internal message to enter alt screen.
EveryCmd
A repeating command that fires at regular intervals.
ExecProcessMsg
Message signaling that an external process should be executed.
ExecResult
Result of executing an external process.
ExitAltScreenMsg
Internal message to exit alt screen.
FenceLanguageResolver
FileTextEdit
Atomic multi-file edit sets for tooling (formatters, refactors, agents).
FixedViewport
A fixed terminal rectangle, using zero-based cell coordinates.
FocusMsg
Message sent when focus is gained or lost.
FoldRange
Foldable line range (both ends inclusive, 0-based).
FoldState
Collapse state over a fold list.
ForegroundColorMsg
Message containing the terminal's foreground color.
Frame TUI
Positioned string composition for one immediate-mode render pass.
FrameArea
A rectangular region in a structured terminal Frame.
FrameConstraint
A requested size along one axis of a FrameLayout.
FrameFill
A weighted share of space left after fixed and percentage constraints.
FrameInsets
Space removed from the edges of a FrameArea before layout.
FrameLayout
Pure helpers for splitting terminal frame areas.
FrameLength
A fixed number of terminal cells.
FramePercentage
A percentage of the available axis before fixed sizes are allocated.
FrameRenderable
A value that can paint itself directly into a terminal Frame.
FrameTickModel
Optional interface for models that want to control frame ticks.
FrameTickMsg
Message sent automatically by the TUI runtime every frame.
FrameView TUI
A View that composes styled strings into positioned terminal regions.
FullScreenTuiRenderer
Full-screen renderer using the alternate screen buffer.
Help
Help information for a key binding.
HideCursorMsg
Internal message to hide cursor.
HitTestMouseMsg
Message dispatched to an element when render-tree hit-testing determines that a MouseMsg landed within its render object's bounds.
HotReloadStatusMsg
Message sent when the hot reload system changes state.
InlineElement
One typed span in a document.
InlineElementStore
Owns a document's live elements: ids, hit-testing, and offset tracking.
InlineTuiRenderer
Inline renderer that renders below the current cursor position.
InterruptMsg
Message sent when the runtime receives a terminal interrupt.
JsonTerminalBackend
Message-oriented backend that speaks the terminal bridge JSON protocol.
Key
Represents a parsed keyboard input event.
KeyBinding
A key binding that maps keys to actions with optional help text.
KeyboardEnhancements
KeyboardEnhancements describes the requested keyboard enhancement features.
KeyboardEnhancementsMsg
Message sent when keyboard enhancements are reported.
KeyChordBinding
A declarative chord binding made of a prefix key and a continuation key.
KeyChordCancelledMsg
Message emitted when a pending chord is cancelled or times out.
KeyChordInterceptor
Interceptor that turns prefix key sequences into chord messages.
KeyChordPrefixMsg
Message emitted when a chord prefix key is recognized.
KeyChordResolvedMsg
Message emitted when a chord resolves to a configured binding.
KeyMap
A collection of key bindings forming a key map.
KeymapActionMsg
A shortcut action was resolved by KeymapHub / a ShortcutSurface.
KeymapHub
Program interceptor that owns a dynamic surface-first stack plus optional base layers.
KeymapLayerClaim
Surface claims the message (optionally transformed). Stops the stack.
KeymapLayerDrop
Surface swallows the message. Stops the stack; nothing is enqueued.
KeymapLayerPass
Surface did not handle the message — try the next layer (or drop if ShortcutSurface.exclusive).
KeymapLayerResult
Outcome of a ShortcutSurface handling one message.
KeymapPendingSequence
Live multi-key sequence state (which-key input).
KeymapSequenceCancelledMsg
A pending multi-key sequence was cancelled or timed out.
KeymapSequencePrefixMsg
A multi-key sequence prefix was recognized (which-key should show).
KeyMsg
Message sent when a key is pressed.
KeyParser
Parses raw terminal input bytes into Key objects and Msg objects.
Keys
Key constants and utilities for keyboard input handling.
LineSpanEdit
One minimal terminal edit for a single row: move the cursor to the 0-based display column and write text (which starts from a reset pen).
MarkdownBlockContext
MarkdownElementStyle
Fine-grained style for a markdown element.
MarkdownRenderer
Renders markdown to ANSI-styled terminal output using standalone functions.
MediaAttachment
One attached media item bound to an inline element id.
MediaViewerState
State for a modal media viewer.
MemoryEditorDocumentStore
In-memory EditorDocumentStore for tests, examples, and recovery drills.
Model TUI
Abstract interface for TUI application models.
ModeReportMsg
Message sent when the terminal replies to a mode status query.
ModifyOtherKeysMsg
Message sent when the terminal reports a ModifyOtherKeys mode.
MouseMsg
Message sent for mouse events.
Msg TUI
Base class for all messages in the TUI runtime.
NullTuiRenderer
A renderer that does nothing (for testing).
OutputLog
An immutable, bounded log of captured output entries.
OutputLogEntry
A single entry in an OutputLog.
PaneLayout
A complete computed layout for all leaf panes and split handles.
PaneLeaf
PaneRect
Rectangle coordinates for leaf pane geometry.
PaneSnapTarget
A target split handle used for snap behavior.
PaneSplit
PaneTreeNode
ParallelCmd
A command that executes multiple commands in parallel through the Program's command execution system.
ParsedSnippet
A parsed snippet: expanded text plus tabstops in document coordinates.
PasteMsg
Message sent when bracketed paste content is received.
PasteTextMsg
Message used by the runtime to deliver collapsed large rune bursts as a single text payload (paste-like behavior).
PlaceholderTracker
Tracks placeholder ranges across document edits.
Point
3D point helper.
PreparedReplay
Prepared replay data including session selection and scenario.
PrimaryDeviceAttributesMsg
Message sent when the terminal replies with primary device attributes.
PrintLineMsg
Message for printing a line above the program output.
ProfileHarnessCommand
Profile subcommand provided by HarnessCommandsMixin.
ProfileHarnessConfig
Configuration for profile harness commands.
Program<M extends Model> TUI
The TUI program runtime.
ProgramDevToolsController
Program-owned state for the universal diagnostics overlay.
ProgramDiagnostics
The single diagnostics data store owned by one running Program.
ProgramDiagnosticsMetrics
Shared registry for metrics contributed by applications and frameworks.
ProgramDiagnosticsOptions
Configuration for the universal in-app program diagnostics overlay.
ProgramHost
Reusable launch target for a Program.
ProgramHostBinding
Resolved runtime configuration produced by a ProgramHost.
ProgramInterceptor
Intercepts program messages and lifecycle events.
ProgramMacro
Recorded user-input macro that can be replayed later.
ProgramOptions
Options for configuring the TUI program.
ProgramRenderCapture
Bundles deterministic snapshot recording with aggregate render monitoring.
ProgramRenderCapturePayload
Structured export payload for one ProgramRenderCapture state snapshot.
ProgramRenderCaptureReport
Structured summary emitted from ProgramRenderCapture.
ProgramRenderChangeSummary
Aggregated native-change summary for one render.
ProgramRenderEvent
One live render event emitted by ProgramRenderFeed.
ProgramRenderFeed
Program interceptor that publishes live render events.
ProgramRenderMonitor
Higher-level render activity monitor built on the live render hook.
ProgramRenderRecorder
Program interceptor that records deterministic render snapshots.
ProgramRenderSnapshot
One deterministic render snapshot captured by ProgramRenderRecorder.
ProgramRenderSnapshotSummary
Compact summary of the most recent captured render snapshot.
ProgramRenderStats
Aggregated render activity across one program run.
ProgramReplay
Message replay source for ProgramOptions.replay.
ProgramReplayStep
One replay step for ProgramReplay.script.
Projectile
A simple projectile integrator mirroring harmonica/projectile.go.
QuitMsg
Internal message signaling that the program should quit.
RawModeGuard
Guard object returned by Terminal.enableRawMode.
ReassemblableModel
Optional interface for models that support hot-reload reassembly.
RenderBudgetController
Tracks render budget pressure and adjusts degradation levels.
RenderBudgetMsg
Message sent when the runtime changes render-budget degradation state.
RenderBudgetOptions
Configuration for budget-aware render degradation.
RenderBudgetState
The current state of a RenderBudgetController.
RenderMetrics
Tracks render performance metrics including FPS, frame times, and render durations.
RenderMetricsModel
Optional interface for models that want render metrics updates.
RenderMetricsMsg
Message sent periodically with renderer performance metrics.
RepaintMsg
Message sent to force a repaint of the view.
RepaintRequestMsg
Internal message to request a repaint.
ReplayAction
Replay action schema used by TUI scenario JSON files.
ReplayCoordinateInterceptor
Coordinate interceptor that scales replay mouse coordinates to current runtime window dimensions.
ReplayCustomEvent
Structured custom event embedded in replay actions.
ReplayEventDirective
Hook decision produced for ReplayCustomEvent actions.
ReplayEventMsg
Replay message emitted for custom event actions.
ReplayEventPresentation
Shared replay-event summary for debug UIs and status surfaces.
ReplayHarnessCommand
Replay subcommand provided by HarnessCommandsMixin.
ReplayHarnessConfig
Configuration for replay harness commands.
ReplayMouseMsg
Replay-only mouse message marker.
ReplayRenderCaptureEvent
Typed replay-side view of one runtime.render_capture custom event.
ReplayScenario
Replay scenario document.
ReplayScreen
Screen metadata captured for replay coordinate scaling.
ReplayTraceConversionOptions
Trace conversion options for ReplayTraceConverter.
ReplayTraceConversionResult
Conversion output returned by ReplayTraceConverter.convertFile.
ReplayTraceConverter
Converts TuiTrace logs into replay scenarios.
ReplayTraceSummary
Summarizes the slowest spans in a trace file.
ReplayTraceSummarySpan
One timed span in a trace summary.
RequestWindowSizeMsg
Internal message to request window size.
ResettableInterceptor
Interceptors that hold multi-step state (chords, macros) implement this so KeymapHub can clear them when a surface is popped or deactivated.
ResizeCoalescer
Decides how aggressively resize events should be coalesced.
ResizeCoalescerState
One decision produced by ResizeCoalescer.next.
ResolvedReplay
Resolved replay plan ready for inline use in a Program command.
ResumeMsg
Message sent when the program resumes from suspension.
SecondaryDeviceAttributesMsg
Message sent when the terminal replies with secondary device attributes.
SequenceMsg
Message produced by Cmd.sequence, wrapping commands that the runtime will execute one at a time, delivering each result via send as it completes before proceeding to the next command.
SetWindowTitleMsg
Internal message to set window title.
ShortcutBinding
A named action bound to a key sequence of length ≥ 1.
ShortcutContinuation
One which-key row for the next key in a pending sequence.
ShortcutSurface
A named, stackable input layer (route, dialog, editor chrome, …).
ShowCursorMsg
Internal message to show cursor.
SimpleTuiRenderer
TuiRenderer that writes output without diffing or clearing (nil renderer mode).
SnippetSession
Ordered tabstop navigation over a ParsedSnippet.
SnippetTabstop
Snippet parsing (${1:default}, $1, $0) with tabstop sessions.
SocketTerminalBackend
Socket-backed backend for remote/shell-mode terminal hosts.
SocketTerminalHostServer
Reusable raw socket host server for remote TUI sessions.
Spinner
A spinner animation definition.
SpinnerModel
A spinner widget for showing loading/activity states.
Spinners
Pre-defined spinner animations.
SpinnerTickMsg
Message indicating a spinner should advance to the next frame.
SplitHandle
Geometry for a split handle used by resize/snap calculations.
SplitTerminal
A terminal that splits "control/input" from "display/output".
Spring
A stable damped spring integrator (Ryan Juckett formulation) matching charmbracelet/harmonica.
StartupProbe
A small, optional initialization probe that can run before the first render.
StartupProbeContext
Context passed to startup probes.
StartupProbeRunner
Runs startup probes and optionally buffers messages while they are active.
StaticComponent
A ViewComponent that only has a view and no state/updates.
StdioTerminal
Standard terminal implementation using dart:io.
StdioTerminalBackend
Native stdio backend for BackendTerminal.
StreamCmd<T>
A command that manages a stream subscription.
StringSinkTuiRenderer
A renderer that writes to a StringSink (for testing).
StringTerminal
A terminal that captures output to a string buffer (for testing).
SuspendMsg
Message signaling the program should suspend (like Ctrl+Z).
SyntaxHighlighter
SyntaxTreeEdit
An incremental edit applied to a previous tree snapshot.
SyntaxTreeProvider
Backend interface for incremental syntax trees.
TerminalBackend
Low-level I/O backend for a terminal host.
TerminalBridge
Bridge controller for embedded terminal hosts such as xterm.js, sockets, or custom UI surfaces.
TerminalBridgeJsonChannel
JSON message channel layered over a TerminalBridge.
TerminalBridgeMessage
JSON-serializable bridge message for remote/browser terminal hosts.
TerminalColorSchemeState
Tracks terminal color-scheme preference separately from terminal colors.
TerminalDirtySpan
Dirty cell range captured from the UV buffer.
TerminalNativeCell
One captured native cell.
TerminalNativeCellDelta
One changed cell between two native frames.
TerminalNativeCellDeltaFrame
Delta snapshot containing changed cells between two native frames.
TerminalNativeColor
Snapshot of a UV color.
TerminalNativeDeltaFrame
Delta snapshot containing only dirty lines from a native frame.
TerminalNativeFrame
Native cell-buffer snapshot of rendered terminal output.
TerminalNativeLine
One captured line from a native frame.
TerminalNativeLineDelta
One changed line in a cell-delta snapshot.
Snapshot of UV link metadata.
TerminalNativeSpan
One grouped semantic span from a native line.
TerminalNativeSpanDelta
Grouped span deltas for one line.
TerminalNativeStyle
Snapshot of UV cell style metadata.
TerminalPaletteService
Message-driven cache and probe helper for terminal palette reports.
TerminalPaletteSnapshot
Immutable snapshot of terminal-reported colors.
TerminalProgressBar
TerminalProgressBar represents the terminal taskbar progress (OSC 9;4).
TerminalRenderFrame
Parsed representation of rendered terminal output.
TerminalRenderLine
Parsed representation of a rendered terminal line.
TerminalState
Terminal state snapshot for saving/restoring.
TerminalThemeState
Tracks terminal-reported colors and background truth.
TerminalVersionMsg
Message sent when the terminal version is reported.
TertiaryDeviceAttributesMsg
Message sent when the terminal replies with tertiary device attributes.
TextCommandResult
TextCursorCommandResult
TextDecorationRange
TextDiagnosticRange
TextDocument
TextDocumentChange
TextDocumentEditResult
TextEditResult
TextExtmark
TextExtmarkOptions
TextExtmarkPositionRange
TextExtmarksController
TextHighlightRange
TextHitResult
TextLineCommandResult
TextLineDecoration
TextLineStateSnapshot
TextOffsetStateSnapshot
TextPasteChunk
TextPasteChunkStep
TextPasteController
TextPastePlan
TextPasteReference
TextPasteReferenceStore
TextPasteSession
TextPatternDiagnosticRule
TextPosition
TextPositionDiagnosticRange
TextSearchMatch
One match in document coordinates.
TextSearchQuery
Regex-capable find/replace over a TextDocument.
TextSearchResult
Result of findTextSearchMatches.
TextSearchSession
Stateful find-next/previous cursor over a match list.
TextSelectionRange
Multi-selection sets for multi-cursor editing flows.
TextSelectionSet
Sorted, non-overlapping selection ranges with a primary index.
TextSyntaxBuildResult<State>
TextSyntaxChangeWindow
TextSyntaxDecorationPatch
TextSyntaxLineWindow
TextSyntaxProvider<State>
TextSyntaxSession<State>
TextSyntaxSnapshot<State>
TextUtf8CoordinateIndex
Reusable UTF-8/grapheme coordinate index for a document snapshot.
TextUtf8Point
A zero-based UTF-8 row and byte-column pair.
TextView
TextViewLine
TextViewport
TextVisualCursorPosition
TickMsg
Message sent when a timer tick occurs.
TilingPaneManager
Immutable tiling pane manager with split tree and focused pane id.
TraceEventRecord
A structured event decoded from one trace log line.
TraceEventType
Structured trace event names emitted by TuiTrace.event.
TraceSessionSelection
Selected trace session information.
TraceSessionSplit
Session data from splitting trace logs.
TraceSpan
A timing span for hierarchical tracing.
TrackedPlaceholderRange
Tracked placeholder ranges for prompt composers.
TtyTerminal
POSIX /dev/tty terminal implementation.
TuiEvidence
Structured runtime evidence logging for diagnostic replayability.
TuiEvidenceRecord
A decoded evidence event line.
TuiRenderer TUI
Abstract renderer interface for TUI output.
TuiRendererOptions
Options for configuring a TuiRenderer.
TuiTrace
Lightweight debug tracer for TUI frame rendering and message dispatch.
UltravioletTuiRenderer
Ultraviolet-inspired renderer backed by a cell buffer + diffing updates.
UndoableCommand<State>
A command that knows how to apply and undo its own effect on a mutable state.
UndoCommandJournalEntry
Journal envelope for one command or transaction.
UndoManager<State>
Undo/redo command journal with optional transactional grouping.
UvCapabilityProbe
Best-effort probe for UV startup capability reports before first render.
UvEventMsg
Raw Ultraviolet event message (only emitted when UV input decoding is enabled).
Vector
3D vector helper.
View TUI
View represents a terminal view that can contain metadata for terminal control.
ViewComponent
A lightweight, composable TUI component.
ViewDegradation
Opt-in degraded content stages for a View.
WebSocketTerminalBackend
WebSocket-backed backend that speaks the terminal bridge JSON protocol.
WindowPixelSizeMsg
Message sent when the terminal window reports its pixel dimensions.
WindowSizeMsg
Message sent when the terminal window is resized.
WorkspaceEdit
Named file edits applied together.
ZoneInBoundsMsg
Message sent when a zone is within bounds of a mouse event.
ZoneInfo
Holds information about the start and end positions of a zone.
ZoneManager
Zone manager for tracking clickable regions in TUI output.
ZoneScanner
Scanner parses zone markers from view output.

Enums

AttachmentPreviewStatus
Media attachment lifecycle for prompt composers.
ClipboardSelection
Clipboard selection targets for OSC 52 operations.
ClipboardSetMethod
Clipboard write transport used by ClipboardSetMsg.
DegradationLevel
Ordered render degradation levels used by the runtime.
EditorCommandDispatchResult
Result of dispatching a command through EditorCommandRegistry.
EditorCompletionKind
Broad category used to decorate and rank a completion.
EditorDocumentScale
Coarse document-size class used to choose bounded editor strategies.
FoldKind
Code folding: indent-based ranges plus collapse state.
FrameAxis
Axis used by FrameLayout.split.
HotReloadStatus
Status of the hot reload system.
ImageProtocol
Terminal image protocol for rendering images inline.
KeyType
Types of keyboard input events.
MediaAffordance
What the composer may do with an attachment right now.
ModeReportValue
The reported state of a terminal mode query.
MouseAction
Mouse event action types.
MouseButton
Mouse button identifiers.
MouseMode
Mouse tracking modes for the terminal.
OutputSource
The origin of a captured output line.
PaneNavigationDirection
Navigation direction used for focus traversal.
PaneSnapAlignment
Snap alignment for drag gestures near a split handle.
PaneSplitDirection
Direction for pane geometry splits.
ProgramDiagnosticsPosition
ReplayEventControl
Replay control decision for a custom replay event.
ScreenMode
Controls how the TUI renders relative to the terminal's primary screen.
TerminalBridgeMessageType
Message kinds used by TerminalBridgeMessage.
TerminalColorKind
Types of terminal colors reported via OSC sequences.
TerminalProgressBarState
TerminalProgressBarState represents the state of the terminal taskbar progress.
TextDecorationLayerKey
TextDiagnosticSeverity
TextPasteMode
TraceTag
Trace categories for filtering and grouping trace output.
UiAnchor
Which edge of the terminal the inline UI region is anchored to.

Mixins

ComponentHost
A mixin for Models that host one or more ViewComponents.
CopyWithModel
Mixin that documents the copyWith pattern for models.
HarnessCommandsMixin
Mixin that adds replay and profile subcommands to a CommandRunner.
HotReloadMixin
Integrates the Dart VM hot-reload lifecycle with a running TUI host.
ProfileHarnessMixin<T>
Mixin that adds profile harness functionality on top of ReplayHarnessMixin.
ReplayHarnessMixin<T>
Mixin providing replay harness functionality for Command subclasses.
TerminalThemeHost
Mixin for models/components that want terminal theme state with minimal boilerplate.

Extensions

CmdExtension on Cmd?
Extension methods for nullable Cmd.
KeyMatchExtension on Key
Extension to check key matches more fluently.
KeyMsgMatchExtension on KeyMsg
Extension to check KeyMsg matches.
ProfileFlagsArgParser on ArgParser
Extension to register profile flags on any ArgParser (standalone usage).
ReplayFlagsArgParser on ArgParser
Extension to register replay flags on any ArgParser (standalone usage).
TextLineStateCommandExtensions on TextLineStateSnapshot
TextOffsetStateCommandExtensions on TextOffsetStateSnapshot
TextOffsetStateDocumentEditingExtensions on TextOffsetStateSnapshot
TuiTerminalRendererExtension on TuiTerminal
Extension to create renderers from terminals.

Constants

bracketClosings → const Map<String, String>
Closing brackets understood by the matcher.
bracketOpenings → const Map<String, String>
Structural bracket matching over a TextDocument.
gravity → const Vector
Gravity helpers (match harmonica names).
inlineElementFileRef → const String
inlineElementImage → const String
Typed inline elements (chips) anchored to document ranges.
inlineElementPaste → const String
shortcutHelpActionId → const String
Default action id for “show shortcuts for this view” (OpenCode help_show).
terminalGravity → const Vector
textActiveLineDecorationKey → const String
textActiveLineDecorationLayerKey → const String
textActiveLineDecorationLayerPriority → const int
textActiveLineNumberDecorationKey → const String
textDefaultDecorationLayerKey → const String
textDefaultDecorationLayerPriority → const int
textDefaultExtmarkType → const String
textDefaultLineDecorationLayerKey → const String
textDefaultLineDecorationLayerPriority → const int
textDiagnosticErrorDecorationKey → const String
textDiagnosticErrorLineDecorationKey → const String
textDiagnosticErrorLineNumberDecorationKey → const String
textDiagnosticHintDecorationKey → const String
textDiagnosticHintLineDecorationKey → const String
textDiagnosticHintLineNumberDecorationKey → const String
textDiagnosticInfoDecorationKey → const String
textDiagnosticInfoLineDecorationKey → const String
textDiagnosticInfoLineNumberDecorationKey → const String
textDiagnosticsDecorationLayerKey → const String
textDiagnosticsDecorationLayerPriority → const int
textDiagnosticsLineDecorationLayerKey → const String
textDiagnosticsLineDecorationLayerPriority → const int
textDiagnosticWarningDecorationKey → const String
textDiagnosticWarningLineDecorationKey → const String
textDiagnosticWarningLineNumberDecorationKey → const String
textSearchActiveMatchDecorationKey → const String
textSearchDecorationLayerKey → const String
textSearchDecorationLayerPriority → const int
textSearchMatchDecorationKey → const String
textSyntaxDecorationLayerKey → const String
textSyntaxDecorationLayerPriority → const int

Properties

globalZone → ZoneManager?
Returns the global zone manager if initialized.
no setter
hasGlobalZone → bool
Whether the global zone manager has been initialized.
no setter
isSharedStdinStreamStarted → bool
Returns true if the shared stdin stream has started listening to stdin.
no setter
sharedStdinStream → Stream<List<int>>
Shared broadcast stream for stdin to allow multiple listeners and restarts.
no setter
zone → ZoneManager
Gets the global zone manager.
no setter

Functions

analyzeReplayTrace(String path, {int limit = 12}) → Future<ReplayTraceSummary>
Analyze a trace file and return the slowest spans.
applyFileEdits(String filePath, String text, List<FileTextEdit> edits) → AppliedFileEdit
Applies edits to text, descending by offset.
applyWorkspaceEdit(Map<String, String> files, WorkspaceEdit edit) → Map<String, AppliedFileEdit>
Applies edit to every file in files (missing files count as empty).
bracketPairRange(TextDocument document, int offset) → ({int endOffset, int startOffset})?
Returns the range covering a bracket pair and everything between the brackets (end exclusive, one past the closing bracket), or null when no pair is found at offset.
chordBindings(KeyMap keyMap) → List<KeyChordBinding>
Extracts chord bindings from keyMap for use with KeyChordInterceptor.
closeGlobalZone() → void
Closes the global zone manager.
commandPaletteVisibleWindow({required int itemCount, required int selectedIndex, required int viewportSize}) → CommandPaletteWindow
Centers selectedIndex inside a window of viewportSize items.
compressAnsi(String input) → String
Removes redundant SGR sequences to reduce output size.
computeIndentFolds(List<String> lineTexts, {int tabWidth = 4}) → List<FoldRange>
Computes indent folds over lineTexts.
computeTextDocumentChange(String previousText, String nextText) → TextDocumentChange
computeTextDocumentChangeForDocuments({required TextDocument previousDocument, required TextDocument nextDocument}) → TextDocumentChange
deleteAfterCursor(List<String> graphemes, int cursorOffset) → TextEditResult
deleteBeforeCursor(List<String> graphemes, int cursorOffset) → TextEditResult
deleteNext(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult
deleteNextDocumentGrapheme(TextDocument document, int cursorOffset) → TextDocumentEditResult
deleteNextGrapheme(List<String> graphemes, int cursorOffset) → TextEditResult
deleteNextOrSelection(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult
deletePrevious(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult
deletePreviousDocumentGrapheme(TextDocument document, int cursorOffset) → TextDocumentEditResult
deletePreviousGrapheme(List<String> graphemes, int cursorOffset) → TextEditResult
deletePreviousOrSelection(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult
deleteSelection(List<String> graphemes, {int? selectionBaseOffset, int? selectionExtentOffset, required int cursorOffset}) → TextCommandResult
deleteSurroundingPair(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required Map<String, String> surroundPairs}) → TextCommandResult
deleteToLineEnd(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineEndOffset}) → TextCommandResult
deleteToLineStart(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineStartOffset}) → TextCommandResult
deleteWordBackward(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required GraphemePredicate isWord}) → TextCommandResult
deleteWordBackwardRange(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})
deleteWordBackwardRangeFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})
deleteWordForward(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required GraphemePredicate isWord}) → TextCommandResult
deleteWordForwardRange(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})
deleteWordForwardRangeFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})
deriveInactive(Color bright, {double factor = 0.2}) → Color
Derives the inactive color for scanner background positions.
deriveTrail(Color bright, {int steps = 6}) → List<Color>
Derives a gradient of trail colors from a single bright color.
detectImageProtocol() → ImageProtocol
Auto-detect the best available terminal image protocol.
duplicateSelectedLinesAbove(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) → TextLineCommandResult
duplicateSelectedLinesBelow(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) → TextLineCommandResult
editorSelectionKey(EditorSelection? selection) → String
Stable key for dismiss tracking (dismissed context stays cleared until the selection changes again).
editorSelectionRangeLabel(EditorSelectionRange range) → String?
Short #line / #start-end label for a range (single-line ranges show just the line).
every(Duration interval, Msg? callback(DateTime time), {Object? id, DateTime nowProvider()?}) → Cmd
Helper to create a repeating timer command.
expandPlaceholderRanges(String text, List<TrackedPlaceholderRange> ranges) → String
Splices each range's TrackedPlaceholderRange.fullText into text.
expandSearchReplacementTemplate(String template, TextSearchMatch match, String matchedText) → String
Expands $& (whole match) and $1–$99 (groups) in template. Unknown references expand to ''. $$ is an escaped dollar.
extractPastedFilePaths(String text) → List<String>
Extracts file-path candidates from pasted or dropped text.
filterEditorCompletions(Iterable<EditorCompletionItem> items, String query) → List<EditorCompletionItem>
Deterministically filters and sorts items for a command palette or popup.
findMatchingBracket(TextDocument document, int offset) → int?
Returns the offset of the bracket matching the one at offset.
findTextQueryHighlights({required TextDocument document, required String query, bool caseSensitive = false}) → List<TextHighlightRange>
findTextSearchMatches(TextDocument document, TextSearchQuery query, {int? maxResults}) → TextSearchResult
Finds query in document.
formatEditorSelectionContext(EditorSelection selection) → String
Builds the context block sent with the prompt for selection.
formatShortcutKeys(List<String> labels, {String separator = ' '}) → String
Join key labels for display (ctrl+x + b → ctrl+x b).
fpsDelta(int n) → double
Returns the time delta for a given frames-per-second value.
highlightCodeString(String code, {String? language, ChromaTheme? theme}) → String
Highlights code and returns ANSI-styled output.
imageCellDimensions(Image image, {int? maxColumns, int? maxRows}) → (int, int)
Determines the approximate cell dimensions for displaying an image.
imageChipText(int displayNumber) → String
Chip text for an attachment. Always path-free: origins appear only in hover/cursor overlays, never in the buffer.
initGlobalZone() → ZoneManager
Initializes the global zone manager.
insertAtCursor(List<String> graphemes, int cursorOffset, List<String> inserted) → TextEditResult
insertAutoPair(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> opening, required List<String> closing}) → TextCommandResult
insertIndentedNewline(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> baseIndent, List<String> additionalIndent = const <String>[], List<String> trailingSuffix = const <String>[], int trailingSuffixReplaceCount = 0}) → TextCommandResult
insertIntoDocument(TextDocument document, int cursorOffset, List<String> inserted) → TextDocumentEditResult
insertTextAtEachSelection(List<String> graphemes, TextSelectionSet selections, List<String> insertion) → ({List<String> graphemes, TextSelectionSet selections})
Inserts insertion graphemes at every range in selections (ranges collapse to the insertion end). Applies descending; returns the new graphemes and set.
insertTextIntoDocument(TextDocument document, int cursorOffset, String inserted) → TextDocumentEditResult
isCriticalStartupProbeMsg(Msg msg) → bool
isDecodableImageBytes(List<int> bytes) → bool
Whether bytes decode as an image (magic-byte probe, not extension).
isImagePath(String path) → bool
File-path recognition for pasted and dropped paths.
jsonChannelHost({required void sendMessage(String message), required Stream<Object?> inboundMessages, Future<void> flushMessages()?, Future<void> closeTransport()?, TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, bool isTerminal = true, ColorProfile colorProfile = ColorProfile.trueColor, ({bool useBackspace, bool useTabs}) movementCaps = (useTabs: false, useBackspace: true)}) → ProgramHost
Creates a ProgramHost backed by a JSON message channel.
keyMapFromShortcutBindings(Iterable<ShortcutBinding> bindings) → KeyMap
Build a KeyMap for HelpView from shortcut bindings.
keyMatches(Key key, List<KeyBinding> bindings) → bool
Checks if a key message matches any of the given bindings.
keyMatchesSingle(Key key, KeyBinding binding) → bool
Checks if a key matches a single binding.
lineSnapshotFromEditorState(EditorState editorState, {required int lineCount, required int lineLength(int line), bool preserveCollapsedSelection = false}) → TextLineStateSnapshot
lineSnapshotFromOffsets(TextDocument document, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextLineStateSnapshot
lineSpanEdit(TerminalRenderLine oldLine, TerminalRenderLine newLine) → LineSpanEdit?
Computes the minimal single-span edit that turns oldLine (currently on the terminal) into newLine, both taken from parsed render frames of the same row. Returns null when the difference has no visible effect (e.g. only zero-width sequences changed, with no impact on later cells).
loadReplayPlan(ReplayHarnessConfig config, {ReplayEventHook? eventHook}) → Future<ResolvedReplay?>
Load a replay plan from configuration for inline use.
mapSelectionEnds(TextSelectionSet selections, {required int mapEnd(int activeOffset, TextSelectionRange range), required bool forward, bool extend = false}) → TextSelectionSet
Moves or extends every range's active edge through mapEnd.
mapSelectionRanges(TextSelectionSet selections, {required TextSelectionRange transform(TextSelectionRange range)}) → TextSelectionSet
Maps each range through transform and rebuilds the set.
markdownToAnsi(String markdown, {AnsiRendererOptions? options}) → String
Converts a markdown string to ANSI-styled terminal text.
matchCommandPaletteItems(List<CommandPaletteItem> items, String query) → List<CommandPaletteMatch>
Filters and ranks items using the established palette matching contract.
mergeTextSyntaxDecorationPatch(List<TextDecorationRange> previousDecorations, TextSyntaxDecorationPatch patch) → List<TextDecorationRange>
moveCursorByCharacter(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveCursorByVisualLine(TextDocument document, EditorState state, TextView view, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineDelta, int desiredDisplayColumn = -1, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveCursorByWord(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, required GraphemePredicate isWord, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveCursorToDocumentBoundary(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveCursorToOffset({required int textLength, required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int targetOffset, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveCursorToVisualLineBoundary(TextDocument document, EditorState state, TextView view, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool end, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult
moveSelectedLines(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, required int direction}) → TextLineCommandResult
moveWordBackward(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → int
moveWordBackwardFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → int
moveWordForward(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → int
moveWordForwardFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → int
newSpringFromFps(int fps, double frequency, double damping) → Spring
Convenience to create a spring using FPS like the Go API.
nextTextPasteChunk({required int totalRunes, required int offset, required int chunkSize}) → TextPasteChunk?
nextWordRange(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})?
nextWordRangeFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})?
noCmd(Model model) → UpdateResult
Helper function to create an update result with no command.
normalizedSelectionRange(int? baseOffset, int? extentOffset) → ({int end, int start})?
normalizePromptContent(String content) → String
Prompt-composer content helpers.
normalizeTextDiagnostics(Iterable<TextDiagnosticRange> diagnostics, {int? maxLength}) → List<TextDiagnosticRange>
offsetSnapshotFromEditorState(TextDocument document, EditorState editorState, {required int textLength, bool preserveCollapsedSelection = false}) → TextOffsetStateSnapshot
parseSnippet(String source) → ParsedSnippet
Parses source into expanded text and tabstops. Never throws: malformed sequences (${x}, unterminated ${1:) emit literally.
partitionImagePaths(Iterable<String> candidates) → ({List<String> images, List<String> other})
Splits candidates into image paths and everything else.
planTextPaste(String content, {required bool collapseLargePaste, required int collapsedPasteMinChars, required int collapsedPasteMinLines, required int chunkThresholdRunes}) → TextPastePlan
previewWorkspaceEdit(Map<String, String> files, WorkspaceEdit edit, {int contextLines = 3}) → String
Renders a unified-style dry-run preview of edit against files.
previousWordRange(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})?
previousWordRangeFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})?
quit(Model model) → UpdateResult
Helper function to create an update result that quits.
reconcileExternalRecords<V>(Map<int, V> records, Set<int> liveIds) → List<V>
Drops sidecar records whose element id is no longer live.
removeDocumentRange(TextDocument document, {required int start, required int end, int? cursorOffset}) → TextDocumentEditResult
removeRange(List<String> graphemes, {required int start, required int end, int? cursorOffset}) → TextEditResult
renderCommandPaletteBody({required String query, required List<CommandPaletteItem> items, required int selectedIndex, required CommandPaletteWindow window, String emptyLabel = 'No matching commands'}) → List<String>
Renders the shared query, rows, and overflow footer used by TEA hosts.
renderImageToAnsi(Image image, ImageProtocol protocol, {int? columns, int? rows}) → String?
Renders an image to ANSI terminal escape sequences using the best available image protocol.
renumberNumberedList(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int startAt = 1}) → TextLineCommandResult
replaceDocumentRange(TextDocument document, {required int start, required int end, List<String> replacement = const <String>[], int? cursorOffset}) → TextDocumentEditResult
replaceDocumentTextRange(TextDocument document, {required int start, required int end, String replacement = '', int? cursorOffset}) → TextDocumentEditResult
replaceRange(List<String> graphemes, {required int start, required int end, List<String> replacement = const <String>[], int? cursorOffset}) → TextEditResult
replaceSelectionOrInsert(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, List<String> replacement = const <String>[], bool replaceSelection = true}) → TextCommandResult
replaceTextSearchMatches(List<String> graphemes, List<TextSearchMatch> matches, List<String> expand(TextSearchMatch match)) → List<String>
Replaces matches in graphemes (e.g. document.flattenWithNewlines()) using expand for each match's replacement graphemes.
replayScenarioStream(List<ReplayAction> actions, {required bool loop, required bool keepOpen, required double speed, ReplayEventHook? eventHook}) → Stream<Msg>
Builds a replay message stream from a list of replay actions.
resolveEditorSelectionRange(TextDocument document, EditorSelectionRange range) → ({int endOffset, int startOffset})
Resolves a wire range to clamped document offsets.
resolveExternalEditorExecutable(Map<String, String> environment, {bool isWindows = false, bool allowFallback = true}) → String?
Resolves the external editor executable from environment variables.
resolveMediaAffordance({required bool protocolSupported, bool forceTextFallback = false}) → MediaAffordance
Resolves the affordance from capability probes. Hosts read the real probes (ultraviolet terminal capabilities); forceTextFallback covers minimal/scrollback-only modes that never paint pixels.
runProgram<M extends Model>(M model, {ProgramOptions options = const ProgramOptions(), ProgramHost? host, TuiTerminal? terminal, TuiRenderer? renderer}) → Future<void>
Runs a TUI program with the given model.
runProgramDebug<M extends Model>(M model, {ProgramOptions? options, ProgramHost? host, TuiTerminal? terminal}) → Future<void>
Runs a TUI program without panic catching (for debugging).
runProgramWithResult<M extends Model>(M model, {ProgramOptions options = const ProgramOptions(), ProgramHost? host, TuiTerminal? terminal, TuiRenderer? renderer}) → Future<M>
Runs a TUI program and returns the final model after exit.
shortcutBindingsFromChords(Iterable<KeyChordBinding> chords) → List<ShortcutBinding>
Map chord bindings into ShortcutBindings.
shutdownSharedStdinStream() → Future<void>
Shuts down the shared stdin stream so the process can exit cleanly.
skipClosingDelimiter(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> closing, bool clearSelection = false}) → TextCursorCommandResult
socketHost(Socket socket, {TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, ColorProfile colorProfile = ColorProfile.trueColor, bool closeSocketOnDispose = true}) → ProgramHost
Creates a ProgramHost backed by a raw Socket for remote or shell-mode terminals.
splitTraceSessions(List<String> lines) → List<TraceSessionSplit>
Splits trace lines into sessions based on # trace start: markers.
syncEditorStateFromLineSnapshot(EditorState editorState, TextLineStateSnapshot snapshot, {required int lineCount, required int lineLength(int line)}) → void
syncEditorStateFromOffsets(TextDocument document, EditorState editorState, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → void
syntaxCapturesToRanges(Iterable<EditorSyntaxCapture> captures) → List<({int endOffset, int priority, int startOffset, String? styleKey})>
Maps EditorSyntaxCaptures to core decoration ranges.
syntaxTreeEditsForDocumentChange(TextDocumentChange change) → List<SyntaxTreeEdit>
Converts a document change into the backend-neutral syntax-tree edit shape.
syntaxTreeEditsForReplacement({required int startOffset, required int oldEndOffset, required int newEndOffset}) → List<SyntaxTreeEdit>
Computes the SyntaxTreeEdit list for a single replacement.
textCapitalizeWords(String text) → String
textCleanupWhitespace({required List<String> lines, required TextLineStateSnapshot state, bool trimTrailingBlankLines = true}) → TextLineCommandResult
textCleanupWhitespaceDocument({required TextDocument document, required TextLineStateSnapshot state, bool trimTrailingBlankLines = true}) → TextCommandResult
textCollapsedPasteToken({required int lineCount}) → String
textCountLines(String text) → int
textDeleteLines({required List<String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult
textDeleteLinesDocument({required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult
textDeleteNext({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textDeletePrevious({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textDeleteSelection({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textDeleteToLineEnd({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textDeleteToLineStart({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textDeleteWordBackward({required TextDocument document, required TextOffsetStateSnapshot state, GraphemePredicate isWord = _isWordGrapheme}) → TextCommandResult
textDeleteWordForward({required TextDocument document, required TextOffsetStateSnapshot state, GraphemePredicate isWord = _isWordGrapheme}) → TextCommandResult
textDiagnosticAtOffset({required List<TextDiagnosticRange> diagnostics, required int offset}) → TextDiagnosticRange?
textDiagnosticContainingIndex({required List<TextDiagnosticRange> diagnostics, required int offset}) → int?
textDiagnosticDecorations(Iterable<TextDiagnosticRange> diagnostics) → List<TextDecorationRange>
textDiagnosticLineDecorations({required String text, required Iterable<TextDiagnosticRange> diagnostics}) → List<TextLineDecoration>
textDiagnosticLineDecorationsForDocument({required TextDocument document, required Iterable<TextDiagnosticRange> diagnostics}) → List<TextLineDecoration>
textDiagnosticLineMarker(TextDiagnosticSeverity severity) → String
textDiagnosticLineNumberStyleKey(TextDiagnosticSeverity severity) → String
textDiagnosticLineStyleKey(TextDiagnosticSeverity severity) → String
textDiagnosticLocationLabel({required String text, required TextDiagnosticRange diagnostic}) → String
textDiagnosticLocationLabelForDocument({required TextDocument document, required TextDiagnosticRange diagnostic}) → String
textDiagnosticNavigationIndex({required List<TextDiagnosticRange> diagnostics, required int cursorOffset, int? activeIndex, bool forward = true, bool wrap = true}) → int?
textDiagnosticSeverityLabel(TextDiagnosticSeverity severity) → String
textDiagnosticsFromPositions({required TextDocument document, required Iterable<TextPositionDiagnosticRange> diagnostics}) → List<TextDiagnosticRange>
textDiagnosticStartPosition({required String text, required TextDiagnosticRange diagnostic}) → TextPosition
textDiagnosticStartPositionForDocument({required TextDocument document, required TextDiagnosticRange diagnostic}) → TextPosition
textDiagnosticStyleKey(TextDiagnosticSeverity severity) → String
textDiagnosticSummaryLabel({required String text, required TextDiagnosticRange diagnostic}) → String
textDiagnosticSummaryLabelForDocument({required TextDocument document, required TextDiagnosticRange diagnostic}) → String
textDuplicateSelectedLinesAbove({required List<String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult
textDuplicateSelectedLinesAboveDocument({required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult
textDuplicateSelectedLinesBelow({required List<String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult
textDuplicateSelectedLinesBelowDocument({required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult
textExtmarkPositionRange(TextDocument document, TextExtmark extmark) → TextExtmarkPositionRange
textIndentLines({required List<String> lines, required TextLineStateSnapshot state, int width = 2}) → TextLineCommandResult
textIndentLinesDocument({required TextDocument document, required TextLineStateSnapshot state, int width = 2}) → TextCommandResult
textInsertGraphemes({required TextDocument document, required TextOffsetStateSnapshot state, required List<String> graphemes, bool replaceSelection = true}) → TextCommandResult
textInsertText({required TextDocument document, required TextOffsetStateSnapshot state, required String text, bool replaceSelection = true}) → TextCommandResult
textJoinLines({required List<String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult
textJoinLinesDocument({required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult
textMoveByCharacter({required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult
textMoveByWord({required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, GraphemePredicate isWord = _isWordGrapheme, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult
textMoveSelectedLines({required List<String> lines, required TextLineStateSnapshot state, required int direction}) → TextLineCommandResult
textMoveSelectedLinesDocument({required TextDocument document, required TextLineStateSnapshot state, required int direction}) → TextCommandResult
textMoveToDocumentBoundary({required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult
textOffsetForUtf8ByteOffset(TextDocument document, int byteOffset) → int
Converts a UTF-8 byte offset from the document start into a grapheme offset.
textOffsetForUtf8Point(TextDocument document, TextUtf8Point point) → int
Converts a UTF-8 parser point into a grapheme offset.
textOffsetOnAdjacentVisibleLine({required TextDocument document, required int offset, required bool below, int? preferredColumn, TextLineHiddenPredicate? isLineHidden}) → int
Resolves the next visible logical line while retaining a preferred column.
textOutdentLines({required List<String> lines, required TextLineStateSnapshot state, int width = 2}) → TextLineCommandResult
textOutdentLinesDocument({required TextDocument document, required TextLineStateSnapshot state, int width = 2}) → TextCommandResult
textPatternDiagnostics({required String text, required Iterable<TextPatternDiagnosticRule> rules}) → List<TextPositionDiagnosticRange>
textPatternDiagnosticsForDocument({required TextDocument document, required Iterable<TextPatternDiagnosticRule> rules}) → List<TextPositionDiagnosticRange>
textPositionForUtf8Point(TextDocument document, TextUtf8Point point) → TextPosition
Converts a UTF-8 parser point into a grapheme-based document position.
textPrepareInsertedGraphemes(List<int> runes, {required bool multiline, int? maxGraphemes}) → List<String>
textRenumberNumberedList({required List<String> lines, required TextLineStateSnapshot state, int startAt = 1}) → TextLineCommandResult
textRenumberNumberedListDocument({required TextDocument document, required TextLineStateSnapshot state, int startAt = 1}) → TextCommandResult
textSanitizeRunes(List<int> runes, {required bool multiline}) → List<int>
textSanitizeRunesLimited(List<int> runes, {required bool multiline, required int maxOutputCodepoints}) → List<int>
textSearchDecorations(Iterable<TextHighlightRange> matches, {int activeIndex = -1}) → List<TextDecorationRange>
textSortSelectedLines({required List<String> lines, required TextLineStateSnapshot state, bool descending = false, bool caseSensitive = false}) → TextLineCommandResult
textSortSelectedLinesDocument({required TextDocument document, required TextLineStateSnapshot state, bool descending = false, bool caseSensitive = false}) → TextCommandResult
textSplitLine({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textSyntaxChangeWindow({required TextDocument previousDocument, required TextDocument nextDocument, required TextDocumentChange change, int lookBehindLines = 0, int lookAheadLines = 0}) → TextSyntaxChangeWindow
textToggleChecklistState({required List<String> lines, required TextLineStateSnapshot state, String checkedMarker = 'x'}) → TextLineCommandResult
textToggleChecklistStateDocument({required TextDocument document, required TextLineStateSnapshot state, String checkedMarker = 'x'}) → TextCommandResult
textToggleHeadingPrefix({required List<String> lines, required TextLineStateSnapshot state, int level = 1}) → TextLineCommandResult
textToggleHeadingPrefixDocument({required TextDocument document, required TextLineStateSnapshot state, int level = 1}) → TextCommandResult
textToggleLinePrefix({required List<String> lines, required TextLineStateSnapshot state, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextLineCommandResult
textToggleLinePrefixDocument({required TextDocument document, required TextLineStateSnapshot state, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextCommandResult
textToggleNumberedList({required List<String> lines, required TextLineStateSnapshot state, int startAt = 1}) → TextLineCommandResult
textToggleNumberedListDocument({required TextDocument document, required TextLineStateSnapshot state, int startAt = 1}) → TextCommandResult
textTransformSelectionOrLine({required TextDocument document, required TextOffsetStateSnapshot state, required String transform(String text)}) → TextCommandResult
textTransformWordOrAdjacent({required TextDocument document, required TextOffsetStateSnapshot state, required String transform(String text)}) → TextCommandResult
textTransposeBackward({required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult
textUnwrapSelection({required TextDocument document, required TextOffsetStateSnapshot state, required Map<String, String> surroundPairs}) → TextCommandResult
textUtf8ByteOffsetForOffset(TextDocument document, int offset) → int
Converts a grapheme offset from the document start into a UTF-8 byte offset.
textUtf8PointForOffset(TextDocument document, int offset) → TextUtf8Point
Converts a grapheme offset into a zero-based UTF-8 parser point.
textUtf8PointForPosition(TextDocument document, TextPosition position) → TextUtf8Point
Converts a document position into a zero-based UTF-8 parser point.
textWrapSelection({required TextDocument document, required TextOffsetStateSnapshot state, required String before, String? after}) → TextCommandResult
toggleChecklistState(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, String checkedMarker = 'x'}) → TextLineCommandResult
toggleDelimitedSegment(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int rangeStartOffset, required int rangeEndOffset, required String startDelimiter, required String endDelimiter}) → TextCommandResult
toggleHeadingPrefix(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int level = 1}) → TextLineCommandResult
toggleLinePrefix(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextLineCommandResult
toggleNumberedList(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int startAt = 1}) → TextLineCommandResult
transformSelectionOrLine(List<String> graphemes, {required int cursorOffset, required int lineStartOffset, required int lineEndOffset, int? selectionBaseOffset, int? selectionExtentOffset, required String transform(String text)}) → TextCommandResult
transformWordOrAdjacent(List<String> graphemes, {required int cursorOffset, required GraphemePredicate isWord, required String transform(String text)}) → TextCommandResult
tryParseTraceSpan(String path, int lineNumber, String line) → ReplayTraceSummarySpan?
Try to parse a single trace line as a timed span.
unwrapSelection(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required Map<String, String> surroundPairs}) → TextCommandResult
validateFileEdits(String filePath, List<FileTextEdit> edits) → List<EditConflict>
Returns the overlap conflicts in edits for filePath (empty = clean).
webSocketHost(WebSocket socket, {TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, bool isTerminal = true, ColorProfile colorProfile = ColorProfile.trueColor, ({bool useBackspace, bool useTabs}) movementCaps = (useTabs: false, useBackspace: true), bool closeSocketOnDispose = true}) → ProgramHost
Creates a ProgramHost backed by a WebSocket using the JSON bridge protocol.
wordRangeForTransform(List<String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})?
wordRangeForTransformFromReader(int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})?
wrapSelection(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> before, List<String>? after}) → TextCommandResult
writeLines(String path, List<String> lines) → Future<void>
Writes lines to a file, creating parent directories if needed.

Typedefs

BrowserTerminalSessionHandler = Future<void> Function(WebSocket socket)
Session handler invoked for each accepted browser websocket connection.
CmdFunc = Cmd Function()
Type alias for a function that creates commands.
CmdFunc1<T> = Cmd Function(T value)
Type alias for a function that creates commands from a value.
CommandPaletteCallback = Cmd? Function()
Callback invoked by a command-palette item.
EditHistoryCoalescePredicate<Action, State, Marker> = bool Function(Action action, {required State currentState, required Action? lastAction, required Marker? lastMarker})
EditHistoryMarkerBuilder<Action, State, Marker> = Marker Function(Action action, State state)
EditHistoryStateEquals<State> = bool Function(State a, State b)
EditorCommandArgumentHandler<T> = bool Function(T target, Object? argument)
Executes an editor command with a host-supplied argument such as insert text.
EditorCommandHandler<T> = bool Function(T target)
Executes an editor command against target.
EditorCommandPredicate<T> = bool Function(T target)
Decides whether an editor command is currently available.
EditorRangeResolver = TextSelectionSet Function(TextDocument document, TextSelectionSet current)
Produces a new selection set from the document and current selections.
FramePainter = void Function(Frame frame)
Signature used by FrameView to paint a structured terminal frame.
GraphemePredicate = bool Function(String grapheme)
GraphemeReader = String? Function(int offset)
MarkdownBlockHandler = String? Function(MarkdownBlockContext context)
MarkerRemover = void Function(int start, int end)
Callback for removing markers from the output.
MessageFilter = Msg? Function(Model model, Msg msg)
A function that filters messages before they reach the model.
ProgramHostResolver = ProgramHostBinding Function(ProgramOptions options)
Resolves a reusable launch target for a Program.
ReplayEventHook = FutureOr<ReplayEventDirective?> Function(ReplayCustomEvent event)
Hook invoked when replay reaches an event action.
SocketTerminalSessionHandler = Future<void> Function(Socket socket)
Session handler invoked for each accepted raw socket terminal connection.
TerminalDimensions = ({int height, int width})
Terminal dimensions expressed in cells.
TextLineHiddenPredicate = bool Function(int line)
Reports whether a logical document line is hidden from vertical movement.
TuiTerminal = Terminal
Alias for backward compatibility.
UndoCommandDecoder<State> = UndoableCommand<State> Function(String type, Map<String, Object?> payload)
UpdateResult = (Model, Cmd?)
Type alias for the update function return type.
ZoneEmitter = void Function(ZoneInfo zone)
Callback for emitting completed zones.

Exceptions / Errors

ProgramCancelledError
Error thrown when a program is cancelled via an external signal.