MingaEditor.Renderer.ResidentWindowState (Minga v0.1.0)

Copy Markdown View Source

Renderer-owned durable state for one editor window/buffer pairing.

The value is keyed by stable window id and is replaced when that window points at another buffer. It owns the complete render cache, durable line identity, resident build/store, row-slot allocator, and the authoritative pending buffer-delta queue held by WindowCache.

Summary

Functions

Applies newly consumed deltas exactly once and retains them until a frame commits.

Copies the renderer-owned cache from a successful pipeline window.

Starts state for a newly observed window/buffer pair.

Requests one explicit full hydration in a fresh content epoch.

Types

hydration_reason()

@type hydration_reason() ::
  :initial
  | :reset_required
  | :buffer_replacement
  | :renderer_restart
  | :identity_reset
  | nil

t()

@type t() :: %MingaEditor.Renderer.ResidentWindowState{
  buffer: pid(),
  change_sequence: non_neg_integer() | nil,
  hydration: hydration_reason(),
  last_version: non_neg_integer() | nil,
  line_count: pos_integer() | nil,
  render_cache: MingaEditor.Renderer.WindowCache.t(),
  window_id: MingaEditor.Window.id()
}

Functions

apply_deltas(state, deltas, changed_snapshot, version, line_count, change_sequence)

Applies newly consumed deltas exactly once and retains them until a frame commits.

commit_window(state, window, observed_version)

@spec commit_window(
  t(),
  MingaEditor.Renderer.RenderWindow.t(),
  non_neg_integer() | nil
) :: t()

Copies the renderer-owned cache from a successful pipeline window.

new(window_id, buffer, reason \\ :initial)

@spec new(MingaEditor.Window.id(), pid(), hydration_reason()) :: t()

Starts state for a newly observed window/buffer pair.

require_hydration(state, reason, version, line_count \\ nil, sequence \\ nil)

@spec require_hydration(
  t(),
  hydration_reason(),
  non_neg_integer(),
  pos_integer() | nil,
  non_neg_integer() | nil
) :: t()

Requests one explicit full hydration in a fresh content epoch.