Minga.RenderModel.Window.Row (Minga v0.1.0)

Copy Markdown View Source

A semantic visual row with an injective retained-render identity.

Row ids use the fixed unsigned 64-bit layout kind:4 | source_id:32 | row_slot:28. Producers must allocate stable row slots; this module never hashes, truncates, or derives a positional fallback.

Summary

Functions

Computes a content hash for cache invalidation, not identity.

Updates transient positional metadata while preserving semantic identity and content.

Builds a decoration identity; row_slot must be producer-allocated integer state.

Builds an injective row id from identity kind, durable source, and stable slot.

Types

identity_kind()

@type identity_kind() ::
  :normal
  | :wrap_continuation
  | :fold_start
  | :virtual_line
  | :block
  | :decoration_fold

row_id()

@type row_id() :: 0..18_446_744_073_709_551_615

row_slot()

@type row_slot() :: 0..268_435_455

row_type()

@type row_type() ::
  :normal | :fold_start | :virtual_line | :block | :wrap_continuation

t()

@type t() :: %Minga.RenderModel.Window.Row{
  buf_line: non_neg_integer(),
  content_hash: non_neg_integer(),
  row_id: row_id(),
  row_type: row_type(),
  spans: [Minga.RenderModel.Window.Span.t()],
  text: String.t(),
  visual_index: non_neg_integer()
}

Functions

compute_hash(text, spans)

@spec compute_hash(String.t(), [Minga.RenderModel.Window.Span.t()]) ::
  non_neg_integer()

Computes a content hash for cache invalidation, not identity.

reposition(row, buf_line)

@spec reposition(t(), non_neg_integer()) :: t()

Updates transient positional metadata while preserving semantic identity and content.

stable_decoration_id(row_type, source_id, row_slot)

@spec stable_decoration_id(row_type(), non_neg_integer(), row_slot()) :: row_id()

Builds a decoration identity; row_slot must be producer-allocated integer state.

stable_id(kind, source_id, row_slot \\ 0)

@spec stable_id(identity_kind(), non_neg_integer(), row_slot()) :: row_id()

Builds an injective row id from identity kind, durable source, and stable slot.