MingaEditor.State.Picker (Minga v0.1.0)

Copy Markdown View Source

Groups picker-related fields from EditorState.

Tracks the current picker instance, the source module providing candidates, the buffer index to restore on cancel, and the action-menu overlay state.

Summary

Types

Action menu state: {actions, selected_index} or nil when closed.

Async loading status for sources that fetch candidates in the background.

t()

Functions

Returns true if a picker is currently open.

Returns a picker state with updated source context.

Updates the inner MingaEditor.UI.Picker instance.

Types

action_menu()

@type action_menu() ::
  {[MingaEditor.UI.Picker.Source.action_entry()], non_neg_integer()} | nil

Action menu state: {actions, selected_index} or nil when closed.

load_status()

@type load_status() :: :ready | :loading | {:error, String.t()}

Async loading status for sources that fetch candidates in the background.

t()

@type t() :: %MingaEditor.State.Picker{
  action_menu: action_menu(),
  context: map() | nil,
  layout: MingaEditor.UI.Picker.Source.layout(),
  load_status: load_status(),
  mode_prefix: String.t(),
  original_source: module() | nil,
  picker: MingaEditor.UI.Picker.t() | nil,
  restore: non_neg_integer() | nil,
  restore_theme: MingaEditor.UI.Theme.t() | nil,
  source: module() | nil
}

Functions

open?(picker)

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

Returns true if a picker is currently open.

put_context(ps, context)

@spec put_context(t(), map() | nil) :: t()

Returns a picker state with updated source context.

update_picker(ps, picker)

@spec update_picker(t(), MingaEditor.UI.Picker.t()) :: t()

Updates the inner MingaEditor.UI.Picker instance.