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
@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
@spec active_struct(t()) :: MingaEditor.Window.t() | nil
Returns the active window struct, or nil if no windows are initialized.
@spec popup_windows(t()) :: [{MingaEditor.Window.id(), MingaEditor.Window.t()}]
Returns all popup windows as a list of {window_id, window} tuples.
Popup windows are those with a non-nil popup_meta field.
Returns true if the window tree contains a split.
@spec update(t(), MingaEditor.Window.id(), (MingaEditor.Window.t() -> MingaEditor.Window.t())) :: t()
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.