# `MingaEditor.Renderer.ResidentWindowState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/renderer/resident_window_state.ex#L1)

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`.

# `hydration_reason`

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

# `t`

```elixir
@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()
}
```

# `apply_deltas`

```elixir
@spec apply_deltas(
  t(),
  [Minga.Buffer.EditDelta.t()],
  Minga.Buffer.RenderSnapshot.t() | nil,
  non_neg_integer(),
  pos_integer(),
  non_neg_integer()
) :: t()
```

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

# `commit_window`

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

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

# `new`

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

Starts state for a newly observed window/buffer pair.

# `require_hydration`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
