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

Groups buffer-related fields from EditorState.

Tracks the active buffer pid, the list of open buffers, the active index,
and special (unlisted) buffers like *Messages*.

# `t`

```elixir
@type t() :: %MingaEditor.State.Buffers{
  active: pid() | nil,
  active_index: non_neg_integer(),
  help: pid() | nil,
  list: [pid()],
  messages: pid() | nil
}
```

# `add`

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

Appends a buffer pid and makes it active.

# `add_background`

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

Appends a buffer pid without changing the active buffer.

# `switch_to`

```elixir
@spec switch_to(t(), non_neg_integer()) :: t()
```

Switches to the buffer at `idx`, wrapping around.

# `switch_to_pid`

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

Switches to the buffer with the given pid, if it exists in the list.

---

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