MingaEditor.MinibufferData (Minga v0.1.0)

Copy Markdown View Source

Structured minibuffer data for the GUI frontend.

Extracts the current minibuffer state (mode, prompt, input, context, completion candidates) from editor state for encoding as the 0x7F gui_minibuffer protocol opcode.

The TUI continues to render the cell-grid minibuffer via MingaEditor.Renderer.Minibuffer. This module serves the native SwiftUI minibuffer only.

Summary

Types

A completion candidate for the minibuffer.

t()

Structured minibuffer data for GUI encoding.

Functions

Clamps a candidate index to the valid range for a candidate list.

Generates completion candidates for an ex command input string.

Extracts structured minibuffer data from the current editor state.

Types

candidate()

@type candidate() :: %{
  label: String.t(),
  description: String.t(),
  match_score: non_neg_integer(),
  match_positions: [non_neg_integer()],
  annotation: String.t()
}

A completion candidate for the minibuffer.

t()

@type t() :: %MingaEditor.MinibufferData{
  candidates: [candidate()],
  context: String.t(),
  cursor_pos: non_neg_integer(),
  input: String.t(),
  mode: non_neg_integer(),
  prompt: String.t(),
  selected_index: non_neg_integer(),
  total_candidates: non_neg_integer(),
  visible: boolean()
}

Structured minibuffer data for GUI encoding.

Functions

clamp_index(index, count)

@spec clamp_index(integer(), non_neg_integer()) :: non_neg_integer()

Clamps a candidate index to the valid range for a candidate list.

Wraps around in both directions so arrow navigation cycles through candidates. Returns 0 for empty lists.

complete_ex_command(input)

@spec complete_ex_command(String.t()) :: {[candidate()], non_neg_integer()}

Generates completion candidates for an ex command input string.

Queries the command registry and fuzzy-matches against the input. Returns up to @max_candidates results sorted by match quality.

from_state(arg1)

@spec from_state(MingaEditor.State.t()) :: t()

Extracts structured minibuffer data from the current editor state.

Returns a t() struct ready for protocol encoding via MingaEditor.Frontend.Protocol.GUI.encode_gui_minibuffer/1.