Editor orchestration GenServer.
Ties together the buffer, port manager, viewport, and modal FSM. Receives
input events from the Port Manager, routes them through Minga.Mode.process/3,
executes the resulting commands against the buffer, recomputes the visible
region, and sends render commands back to the Zig renderer.
The editor starts in Normal mode (Vim-style). The status line reflects
the current mode: -- NORMAL --, -- INSERT --, etc.
Summary
Functions
Send an async message to the Editor GenServer. Used by background tasks.
Returns a specification to start this module under a supervisor.
Ensures a buffer exists for the given file path, opening one if needed.
Opens a file in the editor.
Rebuilds the cached native settings snapshot (#2119).
Triggers a full re-render of the current state.
Starts the editor.
Types
@type effect() :: MingaEditor.Handlers.EffectHandler.effect()
@type start_opt() :: {:name, GenServer.name()} | {:backend, MingaEditor.State.backend()} | {:port_manager, GenServer.server()} | {:parser_manager, GenServer.server()} | {:keymap_server, GenServer.server()} | {:options_server, GenServer.server() | nil} | {:events_registry, Minga.Events.registry()} | {:buffer, pid()} | {:width, pos_integer()} | {:height, pos_integer()} | {:editing_model, :vim | :cua} | {:view_mode, Minga.CLI.view_mode()} | {:shell, :traditional | module()} | {:project_root, String.t() | nil} | {:swap_dir, String.t()} | {:session_dir, String.t()} | {:suppress_tool_prompts, boolean()}
Options for starting the editor.
@type state() :: MingaEditor.State.t()
Internal state.
Functions
@spec cast(term(), GenServer.server()) :: :ok
Send an async message to the Editor GenServer. Used by background tasks.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec ensure_buffer_for_path(String.t(), GenServer.server()) :: {:ok, pid()} | {:error, term()}
Ensures a buffer exists for the given file path, opening one if needed.
Delegates to the Editor GenServer so it can use the editor's options server for buffer creation, then registers the buffer in the workspace (buffer list, monitoring, log message). The buffer is added in the background without switching the active window.
Layer 2 callers that need workspace registration should use this function.
Layer 1 callers (agent tools) should use Buffer.ensure_for_path/1 directly.
@spec open_file(GenServer.server(), String.t()) :: :ok | {:error, term()}
Opens a file in the editor.
@spec refresh_gui_config_state(MingaEditor.State.t()) :: MingaEditor.State.t()
Rebuilds the cached native settings snapshot (#2119).
The snapshot is emitted in-frame as the config_state semantic model, so this
only refreshes the cached struct on EditorState; the next render delivers it
inside the frame transaction. A keyframe re-emits it for free. For non-GUI
frontends the snapshot stays nil and nothing is emitted.
@spec render(GenServer.server()) :: :ok
Triggers a full re-render of the current state.
@spec start_link([start_opt()]) :: GenServer.on_start()
Starts the editor.