MingaEditor.State.Windows (Minga v0.1.0)

Copy Markdown View Source

Groups window-related fields from EditorState.

Tracks the window tree layout, the map of window structs, the active window id, and the next available window id for splits.

Summary

Functions

Returns the active window struct, or nil if no windows are initialized.

Returns all popup windows as a list of {window_id, window} tuples.

Returns true if the window tree contains a split.

Updates the window struct for the given window id.

Types

t()

@type t() :: %MingaEditor.State.Windows{
  active: MingaEditor.Window.id(),
  map: %{required(MingaEditor.Window.id()) => MingaEditor.Window.t()},
  next_id: MingaEditor.Window.id(),
  tree: MingaEditor.WindowTree.t() | nil
}

Functions

active_struct(windows)

@spec active_struct(t()) :: MingaEditor.Window.t() | nil

Returns the active window struct, or nil if no windows are initialized.

split?(windows)

@spec split?(t()) :: boolean()

Returns true if the window tree contains a split.

update(win, id, fun)

Updates the window struct for the given window id.

Applies the given function to the window and stores the result. Returns the struct unchanged if the id is not found.