Persistent native Rope text storage with revisioned atomic edits.
GPUI.Text.Buffer requires the gpui_native package because its Rope storage
is a native resource. If that package is absent or disabled, operations return
{:error, :native_backend_unavailable} rather than calling an unavailable
module.
This is a model primitive. It does not represent a file, editor, language, gutter, or workspace. Consumers own those policies and may later attach one or more renderer primitives to the same buffer.
Summary
Functions
Creates a native text buffer with one primary selection.
Redoes one native transaction and creates a new monotonic revision.
Returns the current text, revision, selections, and history availability.
Atomically applies a transaction based on the current revision.
Undoes one native transaction and creates a new monotonic revision.
Types
@type result(value) :: {:ok, value} | {:error, term()}
@opaque t()
Functions
Creates a native text buffer with one primary selection.
@spec redo(t(), non_neg_integer()) :: result(GPUI.Text.Snapshot.t())
Redoes one native transaction and creates a new monotonic revision.
@spec snapshot(t()) :: result(GPUI.Text.Snapshot.t())
Returns the current text, revision, selections, and history availability.
@spec transact(t(), GPUI.Text.Transaction.t()) :: result(GPUI.Text.Transaction.Result.t())
Atomically applies a transaction based on the current revision.
@spec undo(t(), non_neg_integer()) :: result(GPUI.Text.Snapshot.t())
Undoes one native transaction and creates a new monotonic revision.