Tracks the state of an open popup window.
When a popup rule fires and creates a managed split (or floating overlay),
an Active struct is stored on the window to record the rule that created
it and the previous active window id so focus can be restored when the
popup is closed.
Lifecycle
- A buffer name matches a
Popup.Rulein the registry. Popup.Lifecycle.open_popup/3creates the popup split/float and attaches this struct to the new window'spopup_metafield.- When the user dismisses the popup (quit key, auto-close, or explicit
close),
Popup.Lifecycle.close_popup/2removes the popup's window from the current tree viaWindowTree.close/2(likedelete-windowin Emacs) and restores focus usingprevious_active.
This approach lets multiple popups coexist: closing one only removes its own window from the tree without affecting other popups.
Summary
Functions
Creates a new active popup record.
Types
@type t() :: %MingaEditor.UI.Popup.Active{ previous_active: MingaEditor.Window.id(), rule: Minga.Popup.Rule.t(), window_id: MingaEditor.Window.id() }
Functions
@spec new(Minga.Popup.Rule.t(), MingaEditor.Window.id(), MingaEditor.Window.id()) :: t()
Creates a new active popup record.
Captures the rule that matched, the window id of the new popup window, and the previously active window id for focus restoration on close.