bubbles library TUI

Reusable interactive components for Artisanal TUI.

This library provides a collection of widgets (Bubbles) like text inputs, viewports, progress bars, and spinners that can be composed into larger applications.

Available Widgets

Usage

Bubbles can be composed within your own models using ComponentHost:

class MyModel with ComponentHost implements Model {
  final TextInputModel input;
  final SpinnerModel spinner;

  MyModel({
    TextInputModel? input,
    SpinnerModel? spinner,
  }) : input = input ?? TextInputModel(),
       spinner = spinner ?? SpinnerModel();

  @override
  (Model, Cmd?) update(Msg msg) {
    // Delegate to child bubbles
    final (newInput, inputCmd) = updateComponent(input, msg);
    return (
      MyModel(input: newInput, spinner: spinner),
      inputCmd,
    );
  }

  @override
  String view() => '${spinner.view()} ${input.view()}';
}

Display Components

In addition to interactive models, Artisanal provides DisplayComponents. These are simple string renderers that don't handle input but provide consistent styling for tables, lists, and panels.

Use RenderConfig to adapt these components to the current terminal width and color capabilities.

Bubbles can be composed within your own models using ComponentHost:

class MyModel with ComponentHost implements Model {
  final TextInputModel input;
  final SpinnerModel spinner;

  MyModel({
    TextInputModel? input,
    SpinnerModel? spinner,
  }) : input = input ?? TextInputModel(),
       spinner = spinner ?? SpinnerModel();

  @override
  (Model, Cmd?) update(Msg msg) {
    // Delegate to child bubbles
    final (newInput, inputCmd) = updateComponent(input, msg);
    return (
      MyModel(input: newInput, spinner: spinner),
      inputCmd,
    );
  }

  @override
  String view() => '${spinner.view()} ${input.view()}';
}

In addition to interactive models, Artisanal provides DisplayComponents. These are simple string renderers that don't handle input but provide consistent styling for tables, lists, and panels.

Use RenderConfig to adapt these components to the current terminal width and color capabilities.

Classes

Alert
A fluent builder for creating styled alerts.
AlertComponent
An alert/notice block component.
AnticipateConfig
Configuration for anticipate/autocomplete component.
AnticipateKeyMap
Key map for anticipate navigation and selection.
AnticipateModel
Anticipate model for autocomplete input.
Box
A boxed message component.
BoxBuilder
A fluent builder for creating styled boxes.
BulletList
A bullet list component.
CodeBlockCommentDelimiters
CodeLanguageProfile
Column
Table column definition.
ColumnComponent
A component that renders with a newline after each child.
ColumnsComponent
A multi-column layout component.
Comment
A fluent builder for creating styled comments.
CommentComponent
A comment component (dimmed text with // prefix).
CommonKeyBindings
Commonly used key bindings for navigation.
ComponentBoxChars
Box drawing characters for component system.
CompositeComponent
A component that composes multiple child components.
ConditionalStep
Conditional wizard step.
ConfirmCancelledMsg
Message sent when confirmation is cancelled.
ConfirmKeyMap
Key bindings for the confirm component.
ConfirmModel
A confirmation (yes/no) component following the Model architecture.
ConfirmResultMsg
Message sent when confirmation is made.
ConfirmStep
Confirmation wizard step.
ConfirmStyles
Styles for the confirm component.
CountdownModel
A countdown model built on top of TimerModel.
CursorBlinkMsg
Message indicating the cursor should toggle its blink state.
CursorModel
A blinking cursor widget for text input components.
DataTableModel<T>
A hybrid interactive data table model.
DataTableSelectionMadeMsg<T>
Message sent when a data table row is selected.
DataTableStyles
Styles for the interactive data table.
DebugOverlayModel
Draggable render-metrics overlay for debugging TUI performance.
DefaultItemDelegate
Default item delegate with simple rendering.
DefinitionList
A fluent builder for creating styled definition lists.
DefinitionListComponent
A definition list component (term: description pairs).
DestructiveConfirmModel
A destructive confirmation component that requires typing to confirm.
DiffFile
A file entry in a parsed diff.
DiffLine
A single parsed line from a unified diff.
DiffStyles
Configuration for diff styling.
DisplayComponent
Base type for display-only UI building blocks.
EditHistoryController<Action, State, Marker>
EditorState
ExceptionComponent
An exception renderer component.
FileEntry
A file entry with cached stat information.
FilePickerErrorMsg
Error message when reading a directory fails.
FilePickerKeyMap
Key mappings for the file picker component.
FilePickerModel
A file picker model for navigating and selecting files.
FilePickerReadDirMsg
Message sent when directory contents are read.
FilePickerStyles
Styles for the file picker component.
FilteredItem
Filtered item with match information.
FilteredSearchItem<T>
A filtered item with its original index and match positions.
FilterMatchesMsg
Filter matches message.
GitDiffKeyMap
Key bindings for the git diff viewer.
GitDiffModel
A git diff viewer bubble.
GroupedDefinitionList
A fluent builder for creating grouped definition lists.
GroupStep
Group of wizard steps.
GutterContext
GutterContext provides context to a GutterFunc.
Help
Help information for a key binding.
HelpModel
A help view widget for displaying key bindings.
HelpStyles
Styles for the help view.
HighlightInfo
Describes a text highlight region within the viewport.
HorizontalTableComponent
A horizontal table component (row-as-headers style).
ItemDelegate
Item delegate for rendering list items.
KeyBinding
A key binding that maps keys to actions with optional help text.
KeyMap
A collection of key bindings forming a key map.
KeyValue
A key-value pair component with dot fill.
LineInfo
LinkComponent
A clickable hyperlink component (OSC 8).
LinkGroupComponent
A group of related links component.
ListEnumerator
Defines how list items are explicitly enumerated.
ListItem
Item interface for list items.
ListKeyMap
Key map for list navigation.
ListModel
List model for interactive lists.
ListStyles
Styles for list rendering.
Markdown
A component that renders markdown to ANSI-styled terminal output.
MarkdownOptions
Configuration options for the Markdown component.
MultiProgressModel
A model for managing multiple progress bars simultaneously.
MultiSearchKeyMap
Key bindings for the multi-search component.
MultiSearchModel<T>
A multi-select search/filter component.
MultiSearchSelectionMadeMsg<T>
Message sent when multiple search results are selected.
MultiSelectionMadeMsg<T>
Message sent when multiple items are selected.
MultiSelectKeyMap
Key bindings for the multi-select component.
MultiSelectModel<T>
A multi-select component following the Model architecture.
MultiSelectStep
Multi-select wizard step.
MultiSelectStyles
Styles for the multi-select component.
NumberCancelledMsg
Emitted when the user cancels the prompt.
NumberedList
A numbered list component.
NumberInputKeyMap
Key bindings for NumberInputModel.
NumberInputModel
Interactive numeric input component.
NumberInputStyles
Visual styles for NumberInputModel.
NumberSubmittedMsg
Emitted when the user submits a valid number.
PaginatorKeyMap
Key bindings for paginator navigation.
PaginatorModel
A paginator widget for handling pagination state and rendering.
Panel
A fluent builder for creating styled panels.
PanelBoxChars
Box drawing characters for panels and borders.
PanelBoxCharSet
A set of box drawing characters.
PanelComponent
A boxed panel component with optional title.
PasswordCancelledMsg
Message sent when password input is cancelled.
PasswordConfirmModel
A password confirmation component that asks for password twice.
PasswordKeyMap
Key bindings for the password component.
PasswordModel
A password input component following the Model architecture.
PasswordStep
Password input wizard step.
PasswordStyles
Styles for the password component.
PasswordSubmittedMsg
Message sent when password input is submitted.
PasteErrorMsg
Message for paste errors.
PasteMsg
Message for paste events.
PauseModel
A simple "press any key" pause model.
ProgressBar
A progress indicator component.
ProgressBarAdvanceMsg
ProgressBarComponent TUI
A progress bar component.
ProgressBarIterateDoneMsg
ProgressBarIterateErrorMsg
ProgressBarModel
A UV-safe progress bar model that can be hosted inside a parent Model.
ProgressBarMsg
ProgressBarSetMsg
ProgressFrameMsg
Message indicating a progress bar animation frame should advance.
ProgressModel
A progress bar widget with optional animation support.
Rank
Rank from filtering.
RenderConfig TUI
Rendering configuration for display-only UI building blocks.
RowComponent
A component that renders children horizontally with a separator.
Rule
A horizontal rule/separator component.
SanitizerOptions
Options for configuring the sanitizer behavior.
ScrollbarChars
SearchCancelledMsg
Message sent when search is cancelled.
SearchKeyMap
Key bindings for the search component.
SearchModel<T>
A search/filter component following the Model architecture.
SearchSelectionMadeMsg<T>
Message sent when a search result is selected.
SearchStyles
Styles for the search component.
SelectionCancelledMsg
Message sent when selection is cancelled.
SelectionMadeMsg<T>
Message sent when an item is selected.
SelectKeyMap
Key bindings for the select component.
SelectModel<T>
A single-select component following the Model architecture.
SelectStep
Single-select wizard step.
SelectStyles
Styles for the select component.
SimpleExceptionComponent
A simple one-line exception component.
Spinner
A spinner animation definition.
SpinnerFrame
A spinner frame component (for use in animations).
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.
StatusMessageTimeoutMsg
Status message timeout message.
StopwatchModel
A stopwatch model that counts up from zero.
StopwatchResetMsg
Message sent to reset the stopwatch.
StopwatchStartStopMsg
Message sent to start or stop the stopwatch.
StopwatchTickMsg
Message sent when the stopwatch ticks.
StringItem
Simple string item implementation.
StyledBlock
A fluent builder for creating styled blocks (Symfony-style).
StyledBlockComponent
A styled block component (Symfony-style).
StyledText
A styled text component using the context's style.
SuggestCancelledMsg
Emitted when the user cancels the suggest prompt.
SuggestKeyMap
Key bindings for SuggestModel.
SuggestModel
Interactive text-input with a scrollable prefix-matched suggestion dropdown.
SuggestStyles
Visual styles for SuggestModel.
SuggestSubmittedMsg
Emitted when the user accepts a value (typed or from the dropdown).
Table
A fluent builder for creating styled tables.
TableComponent
A table component with headers and rows.
TableKeyMap
Key map for table navigation.
TableModel
Table model for interactive tables.
TableStyles
Styles for table rendering.
TableTheme
A composable table theme with blend-aware effects and presets.
TableThemeEffect
A composable style rule for table cells.
TaskComponent
A task status component (Laravel-style).
Text
A simple text component.
TextAreaCursorStyle
TextAreaKeyMap
TextAreaModel
TextAreaPasteErrorMsg
TextAreaPasteMsg
TextAreaStyles
TextAreaStyleState
TextCommandResult
TextCursorCommandResult
TextDecorationRange
TextDiagnosticRange
TextDocument
TextDocumentChange
TextDocumentEditResult
TextEditResult
TextExtmark
TextExtmarkOptions
TextExtmarkPositionRange
TextExtmarksController
TextHighlightRange
TextHitResult
TextInputCursorStyle
Style for the cursor.
TextInputKeyMap
Key map for text input navigation and editing.
TextInputModel
Text input model for single-line or multi-line text entry.
TextInputStep
Text input wizard step.
TextInputStyles
Styles for the text input.
TextInputStyleState
Style state for focused and blurred states.
TextLineCommandResult
TextLineDecoration
TextLineStateSnapshot
TextModel
A high-level text component that supports selection, scrolling, and wrapping. It is built on top of ViewportModel but defaults to auto-height and soft-wrap.
TextOffsetStateSnapshot
TextPasteChunk
TextPasteChunkStep
TextPasteController
TextPastePlan
TextPasteReference
TextPasteReferenceStore
TextPasteSession
TextPatternDiagnosticRule
TextPosition
TextPositionDiagnosticRange
TextSelection
TextSyntaxBuildResult<State>
TextSyntaxChangeWindow
TextSyntaxDecorationPatch
TextSyntaxLineWindow
TextSyntaxProvider<State>
TextSyntaxSession<State>
TextSyntaxSnapshot<State>
TextView
TextViewLine
TextViewport
TextVisualCursorPosition
TimerModel
A countdown timer model.
TimerStartStopMsg
Message sent to start or stop the timer.
TimerTickMsg
Message sent when the timer ticks.
TimerTimeoutMsg
Internal message sent when timer times out.
TitledBlockComponent
A simple titled block used by the artisanal-style I/O facade.
Tree
A fluent builder for creating styled trees (lipgloss v2 parity).
TreeChildren
TreeComponent
A tree structure component.
TreeEnumerator
Defines the characters used to draw tree branches.
TreeFilter
TreeNode
TreeNodeChildren
TreeStringData
TwoColumnDetail
A fluent builder for creating two-column detail rows.
TwoColumnDetailComponent
A two-column detail component with dot fill.
TwoColumnDetailList
A fluent builder for creating multiple two-column detail rows.
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.
ViewportKeyMap
Key bindings for viewport navigation.
ViewportModel
A viewport widget for scrollable content.
ViewportScrollPane
ViewState
Stores the view state when navigating into directories.
WizardCancelledMsg
Message sent when the wizard is cancelled.
WizardCompletedMsg
Message sent when the entire wizard is completed.
WizardModel
Wizard model for multi-step forms.
WizardStep
Base class for wizard steps.
WizardStepCompletedMsg
Message sent when a wizard step is completed.

Enums

AlertDisplayStyle
Alert display style.
AlertType
Alert types.
BlockStyleType
Block style types.
BorderStyle
Border styles for boxes.
BoxAlign
Alignment for box content.
ConfirmDisplayMode
Display mode for the confirm component.
CursorMode
Cursor display mode.
DiffLineType
The type of a parsed diff line.
DiffViewMode
The display mode for the diff viewer.
EchoMode
Echo mode for text input display.
FilterState
Filter state for the list.
PaginationType
Pagination rendering type.
PanelAlignment
Alignment for panel content.
PasswordEchoMode
Echo mode for password display.
StyledBlockDisplayStyle
Display style for styled blocks.
TableAlign
Column alignment options for tables.
TableBlendMode
Blend mode used by themed table effects.
TableThemeGradientAxis
The axis for sampling gradient colors in a table theme.
TableThemeSection
The table section an effect should apply to.
TaskStatus
Task status values.
TextDiagnosticSeverity
TextPasteMode

Extensions

AlertFactory on Alert
Factory methods for common alert styles.
BoxPresets on BoxBuilder
Factory methods for common box styles.
DefinitionListFactory on DefinitionList
Factory methods for common definition list styles.
KeyMatchExtension on Key
Extension to check key matches more fluently.
KeyMsgMatchExtension on KeyMsg
Extension to check KeyMsg matches.
PanelPresets on Panel
Factory methods for common panel styles.
StyledBlockFactory on StyledBlock
Factory methods for common styled block styles.
TableFactory on Table
Factory methods for common table styles.
TextLineStateCommandExtensions on TextLineStateSnapshot
TextOffsetStateCommandExtensions on TextOffsetStateSnapshot
TextOffsetStateDocumentEditingExtensions on TextOffsetStateSnapshot
TreeFactory on Tree
Factory methods for common tree styles.
TwoColumnDetailFactory on TwoColumnDetail
Factory methods for common two-column detail styles.

Constants

dataTablePromptOptions → const ProgramOptions
Dedicated defaults for interactive data-table prompts.
defaultCodeAutoPairs → const Map<String, String>
defaultCodeClosingToOpening → const Map<String, String>
defaultEmptyCharBlock → const String
Default character used to fill the empty portion of the progress bar.
defaultFullCharFullBlock → const String
Default character used to fill the progress bar (full block).
defaultFullCharHalfBlock → const String
Default character used to fill the progress bar. It is a half block, which allows more granular color blending control.
promptProgramOptions → const ProgramOptions
Shared defaults for "artisanal-style" prompts that run a single bubble and return a value.
textActiveLineDecorationKey → const String
textActiveLineDecorationLayerKey → const String
textActiveLineDecorationLayerPriority → const int
textActiveLineNumberDecorationKey → const String
textareaPromptOptions → const ProgramOptions
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
undefined → const Object
Sentinel value to distinguish "not provided" from "explicitly set to null" in ViewportModel.copyWith. This allows callers to set nullable fields to null (e.g., copyWith(selectionStart: null)) rather than keeping the existing value (the default when the parameter is omitted).

Functions

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
computeTextDocumentChange(String previousText, String nextText) TextDocumentChange
computeTextDocumentChangeForDocuments({required TextDocument previousDocument, required TextDocument nextDocument}) TextDocumentChange
createSanitizer([SanitizerOptions? options]) RuneSanitizer
Creates a rune sanitizer with the given options.
defaultFilter(String term, List<String> targets) List<Rank>
Default fuzzy filter implementation.
defaultSearchFilter<T>(String query, List<T> items, String toString(T)) List<FilteredSearchItem<T>>
Default fuzzy filter implementation.
defaultTextAreaStyles() TextAreaStyles
defaultTextInputStyles({bool isDark = true}) TextInputStyles
Returns the default styles for the text input.
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})
duplicateSelectedLinesAbove(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) TextLineCommandResult
duplicateSelectedLinesBelow(List<String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) TextLineCommandResult
findTextQueryHighlights({required TextDocument document, required String query, bool caseSensitive = false}) List<TextHighlightRange>
firstGraphemeCluster(String s) → ({String first, String rest})
Gets the first grapheme cluster from a string.
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
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
mathMax(int a, int b) int
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
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})?
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})?
progressIterateCmd<T>({required int id, required Iterable<T> items, required Future<void> onItem(T item)}) StreamCmd<Msg>
Produces a UV-safe StreamCmd that runs onItem for each element and emits progress updates for a hosted ProgressBarModel.
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
resolveCodeLanguageProfile(String? language) CodeLanguageProfile
runAnticipatePrompt(AnticipateModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs an AnticipateModel and resolves to the accepted value, or null if cancelled.
runConfirmPrompt(ConfirmModel model, Terminal terminal, {ProgramOptions? options}) Future<bool?>
Runs a ConfirmModel and resolves to the selected value, or null if cancelled.
runDataTablePrompt<T>(DataTableModel<T> model, Terminal terminal, {ProgramOptions? options}) Future<T?>
Runs a DataTableModel and resolves to the selected item, or null if cancelled.
runeWidth(int rune) int
Calculates the display width of a single rune.
runMultiSearchPrompt<T>(MultiSearchModel<T> model, Terminal terminal, {ProgramOptions? options}) Future<List<T>?>
Runs a MultiSearchModel and resolves to the selected items, or null if cancelled.
runMultiSelectPrompt<T>(MultiSelectModel<T> model, Terminal terminal, {ProgramOptions? options}) Future<List<T>?>
Runs a MultiSelectModel and resolves to the selected items, or null if cancelled.
runNumberInputPrompt(NumberInputModel model, Terminal terminal, {ProgramOptions? options}) Future<num?>
Runs a NumberInputModel and resolves to the submitted number, or null if the user cancels.
runPasswordConfirmPrompt(PasswordConfirmModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs a PasswordConfirmModel and resolves to the submitted password, or null if cancelled.
runPasswordPrompt(PasswordModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs a PasswordModel and resolves to the submitted password, or null if cancelled.
runSearchPrompt<T>(SearchModel<T> model, Terminal terminal, {ProgramOptions? options}) Future<T?>
Runs a SearchModel and resolves to the selected item, or null if cancelled.
runSelectPrompt<T>(SelectModel<T> model, Terminal terminal, {ProgramOptions? options}) Future<T?>
Runs a SelectModel and resolves to the selected item, or null if cancelled.
runSpinnerTask<T>({required String message, required Future<T> task(), Spinner spinner = Spinners.miniDot, required Terminal terminal, ProgramOptions? options}) Future<T>
Runs an animated spinner while executing task, returning its result.
runSuggestPrompt(SuggestModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs a SuggestModel and resolves to the accepted value, or null if the user cancels.
runTextAreaPrompt(TextAreaModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs a TextAreaModel and resolves to the submitted value, or null if cancelled.
runTextInputPrompt(TextInputModel model, Terminal terminal, {ProgramOptions? options}) Future<String?>
Runs a TextInputModel and resolves to the submitted value, or null if cancelled.
runWizardPrompt(WizardModel model, Terminal terminal, {ProgramOptions? options}) Future<Map<String, dynamic>?>
Runs a WizardModel and resolves to the final answers, or null if cancelled.
skipClosingDelimiter(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> closing, bool clearSelection = false}) TextCursorCommandResult
stringWidth(String s) int
Calculates the display width of a string, accounting for wide characters.
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
truncate(String s, int width, [String tail = '']) String
Truncates a string to fit within the given width.
unwrapSelection(List<String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required Map<String, String> surroundPairs}) TextCommandResult
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

Typedefs

AlertStyleFunc = Style? Function(String line, int lineIndex)
Callback for alert message styling.
BoxContentStyleFunc = Style? Function(String line, int lineIndex)
Callback for box content styling.
ColorFunc = Color Function(double total, double current)
Function that can be used to dynamically fill the progress bar. total is the total filled percentage, and current is the current percentage that is actively being filled with a color.
DefinitionStyleFunc = Style? Function(String term, String description, int index, bool isTerm)
Callback for styling definition list items.
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)
FilterFunc = List<Rank> Function(String term, List<String> targets)
Filter function type.
GraphemePredicate = bool Function(String grapheme)
GraphemeReader = String? Function(int offset)
GutterFunc = String Function(GutterContext context)
GutterFunc can be implemented and set into ViewportModel.leftGutterFunc.
ListStyleFunc = Style? Function(int index, String item)
Callback for per-item styling in lists.
PanelContentStyleFunc = Style? Function(String line, int lineIndex)
Callback for panel content styling.
PromptFunc = String Function(PromptInfo info)
PromptInfo = ({int col, bool isFocused, int lineIndex, int row})
Row = List<String>
Table row (list of cell values).
RuneSanitizer = List<int> Function(List<int> runes)
Function type for sanitizing rune lists.
SearchFilterFunc<T> = List<FilteredSearchItem<T>> Function(String query, List<T> items, String toString(T))
Filter function type for search.
StyledBlockStyleFunc = Style? Function(String line, int lineIndex)
Callback for block content styling.
TableStyleFunc = Style? Function(int row, int col, String data)
Callback for per-cell styling in tables.
TreeEnumeratorFunc = String Function(List<TreeNode> children, int index)
TreeEnumeratorStyleFunc = Style? Function(List children, int index)
Callback for per-item enumerator (branch character) styling in trees.
TreeIndenterFunc = String Function(List<TreeNode> children, int index)
TreeNodeStyleFunc = Style Function(List<TreeNode> children, int index)
TreeStyleFunc = Style? Function(String item, int depth, bool isDirectory)
Callback for per-item styling in trees.
TwoColumnStyleFunc = Style? Function(String text, bool isLeft)
Callback for styling the left or right column.
UndoCommandDecoder<State> = UndoableCommand<State> Function(String type, Map<String, Object?> payload)
ValidateFunc = String? Function(String value)
Validation function that returns an error message if input is invalid.