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, and Cmd.batch to group multiple commands.

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, and Cmd.batch to group multiple commands.

  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.
ArtisanalDevTools
DevTools integration for artisanal TUI programs.
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.
CodeBlockCommentDelimiters
CodeLanguageProfile
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.
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.
EditBuffer
EditHistoryController<Action, State, Marker>
EditorCoreConfig
EditorState
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
FocusMsg
Message sent when focus is gained or lost.
ForegroundColorMsg
Message containing the terminal's foreground color.
FrameTickModel
Optional interface for models that want to control frame ticks.
FrameTickMsg
Message sent automatically by the TUI runtime every frame.
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.
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.
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.
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.
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).
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.
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.
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.
SetWindowTitleMsg
Internal message to set window title.
ShowCursorMsg
Internal message to show cursor.
SimpleTuiRenderer
TuiRenderer that writes output without diffing or clearing (nil renderer mode).
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
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
TextSyntaxBuildResult<State>
TextSyntaxChangeWindow
TextSyntaxDecorationPatch
TextSyntaxLineWindow
TextSyntaxProvider<State>
TextSyntaxSession<State>
TextSyntaxSnapshot<State>
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.
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.
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

ClipboardSelection
Clipboard selection targets for OSC 52 operations.
ClipboardSetMethod
Clipboard write transport used by ClipboardSetMsg.
DegradationLevel
Ordered render degradation levels used by the runtime.
HotReloadStatus
Status of the hot reload system.
KeyType
Types of keyboard input events.
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.
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
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.
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

defaultCodeAutoPairs → const Map<String, String>
defaultCodeClosingToOpening → const Map<String, String>
gravity → const Vector
Gravity helpers (match harmonica names).
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.
chordBindings(KeyMap keyMap) List<KeyChordBinding>
Extracts chord bindings from keyMap for use with KeyChordInterceptor.
closeGlobalZone() → void
Closes the global zone manager.
codeBlockNewlineSuffix({required String beforeCursor, required String afterCursor, required String baseIndent}) → ({int consumedColumns, String text})?
codeHandleAutoPair({required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile, required String typed}) TextCommandResult
codeHandleClosingDelimiterAlignment({required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile, required String typed, required int indentWidth}) TextCommandResult
codeHandlePairBackspace({required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile}) TextCommandResult
codeInsertIndentedNewline({required TextDocument document, required TextOffsetStateSnapshot state, required int indentWidth, String? language}) TextCommandResult
codeLeadingIndent(String line) String
codeOutdentedIndent(String indent, int width) String
codeShouldAutoPairSymmetricDelimiter(String text, int offset, {bool hasSelection = false}) bool
codeShouldAutoPairSymmetricDelimiterInDocument(TextDocument document, int offset, {bool hasSelection = false}) bool
codeShouldIncreaseIndentAfter(String prefix, {String? language}) bool
codeToggleBlockComments({required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile}) TextCommandResult
compressAnsi(String input) String
Removes redundant SGR sequences to reduce output size.
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.
duplicateSelectedLinesAbove(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) TextLineCommandResult
duplicateSelectedLinesBelow(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) TextLineCommandResult
every(Duration interval, Msg? callback(DateTime time), {Object? id, DateTime nowProvider()?}) Cmd
Helper to create a repeating timer command.
findTextQueryHighlights({required TextDocument document, required String query, bool caseSensitive = false}) List<TextHighlightRange>
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.
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
insertTextIntoDocument(TextDocument document, int cursorOffset, String inserted) TextDocumentEditResult
isCriticalStartupProbeMsg(Msg msg) bool
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.
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
loadReplayPlan(ReplayHarnessConfig config, {ReplayEventHook? eventHook}) Future<ResolvedReplay?>
Load a replay plan from configuration for inline use.
markdownToAnsi(String markdown, {AnsiRendererOptions? options}) String
Converts a markdown string to ANSI-styled terminal text.
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})?
normalizeTextDiagnostics(Iterable<TextDiagnosticRange> diagnostics, {int? maxLength}) List<TextDiagnosticRange>
offsetSnapshotFromEditorState(TextDocument document, EditorState editorState, {required int textLength, bool preserveCollapsedSelection = false}) TextOffsetStateSnapshot
planTextPaste(String content, {required bool collapseLargePaste, required int collapsedPasteMinChars, required int collapsedPasteMinLines, required int chunkThresholdRunes}) TextPastePlan
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.
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
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
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.
resolveCodeLanguageProfile(String? language) CodeLanguageProfile
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.
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
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
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>
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
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
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.
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)
GraphemePredicate = bool Function(String grapheme)
GraphemeReader = String? Function(int offset)
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.
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.