MingaEditor.State.Buffers (Minga v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Appends a buffer pid and makes it active.

Appends a buffer pid without changing the active buffer.

Switches to the buffer at idx, wrapping around.

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

Types

t()

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

Functions

add(bs, pid)

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

Appends a buffer pid and makes it active.

add_background(bs, pid)

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

Appends a buffer pid without changing the active buffer.

switch_to(bs, idx)

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

Switches to the buffer at idx, wrapping around.

switch_to_pid(bs, pid)

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

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