Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Mosaic_ui.Textarea
Multi-line text editor with wrapping, scrolling, and selection.
Multi-line text editing widget with wrapping, selection, and scrolling.
A textarea wraps a Renderable.t with an Edit_buffer.t, Text_buffer.t, and Text_surface.t, providing keyboard-driven multi-line text editing with word/character wrapping, vertical scrolling, selection highlighting, cursor display, and placeholder text. Supports undo/redo, word-level and line-level navigation, and configurable visual styling.
The widget fires four callbacks:
on_input: after every text change (keystroke-level).
on_change: when the committed value differs on blur or submit.
on_submit: when Cmd+Enter or Ctrl+Enter is pressed.
on_cursor: when cursor position or selection changes.
See Text_input for single-line editing and Text for read-only display.
edit t f runs f on the underlying buffer. If f returns true (indicating the buffer changed), syncs the display, fires on_input and on_cursor callbacks, and scrolls to keep the cursor visible. Use this for programmatic edits such as snippet insertion, indentation, or LSP-driven text changes.
Callbacks
val set_on_input : t->(string -> unit) option-> unit
set_on_input t handler sets the keystroke-level input callback.
val set_on_change : t->(string -> unit) option-> unit
set_on_change t handler sets the committed-value change callback.
val set_on_submit : t->(string -> unit) option-> unit
set_on_submit t handler sets the Cmd/Ctrl+Enter submit callback.
val set_on_cursor :
t->(cursor:int ->selection:(int * int) option-> unit) option->
unit
set_on_cursor t handler sets the cursor/selection change callback. It fires when cursor position or selection changes.