GPUI.Text.Transaction (gpui v0.2.0)

Copy Markdown View Source

A revisioned atomic set of text edits and resulting selections.

Use new/2 with a GPUI.Text.Snapshot when preparing an external edit. The constructor copies the snapshot revision and current selections, so callers specify only what changes. Pass :selections when the transaction should produce a different complete selection set.

Summary

Functions

Builds a validated transaction against the supplied text snapshot.

Validates a transaction's public shape and returns it.

Types

origin()

@type origin() :: atom() | String.t()

t()

@type t() :: %GPUI.Text.Transaction{
  base_revision: non_neg_integer(),
  edits: [GPUI.Text.Edit.t()],
  id: String.t(),
  origin: origin(),
  selections: [GPUI.Text.Selection.t()]
}

Functions

new(snapshot, opts)

@spec new(
  GPUI.Text.Snapshot.t(),
  keyword()
) :: t()

Builds a validated transaction against the supplied text snapshot.

validate!(transaction)

@spec validate!(t()) :: t()

Validates a transaction's public shape and returns it.