# `MingaEditor.State.BufferLifecycle`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/state/buffer_lifecycle.ex#L1)

Editor-mailbox correlation for buffer process lifecycle events.

The Editor process creates monitors; this value only records their identity
and the shell context associated with the next buffer registration.

# `t`

```elixir
@type t() :: %MingaEditor.State.BufferLifecycle{
  buffer_add_context: MingaEditor.Shell.buffer_add_context(),
  buffer_monitors: %{required(pid()) =&gt; reference()}
}
```

# `consume_buffer_context`

```elixir
@spec consume_buffer_context(t()) :: {MingaEditor.Shell.buffer_add_context(), t()}
```

Consumes the pending add context and restores the default open behavior.

# `expect_buffer`

```elixir
@spec expect_buffer(t(), MingaEditor.Shell.buffer_add_context()) :: t()
```

Records how the shell should integrate the next added buffer.

# `monitored?`

```elixir
@spec monitored?(t(), pid()) :: boolean()
```

Returns whether a monitor is already recorded for a buffer.

# `record_monitor`

```elixir
@spec record_monitor(t(), pid(), reference()) :: t()
```

Records the first monitor reference created for a buffer.

# `retire_monitor`

```elixir
@spec retire_monitor(t(), pid()) :: t()
```

Forgets the monitor correlated with a terminal buffer exit.

---

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