MingaEditor.WindowFocus (Minga v0.1.0)

Copy Markdown View Source

Focused workflow for window focus, buffer cursor calls, and shell focus presentation.

Summary

Functions

Focuses a window after saving and restoring its buffer cursor state.

Focuses a window and reports why an ownership-safe transition was rejected.

Focuses a surviving window after the active split was removed.

Snapshots the active cursor only when the active window owns its buffer source.

Snapshots the active cursor and reports ownership failures without changing state.

Repairs a window with a viable buffer or empty surface, then restores focus to it.

Restores focus without reading the outgoing window's buffer, for popup dismissal.

Types

focus_failure()

@type focus_failure() ::
  :window_not_found | :cursor_source_mismatch | :buffer_unavailable

focus_result()

@type focus_result() :: {:ok, state()} | {:error, focus_failure()}

state()

@type state() :: MingaEditor.State.t()

Functions

focus(state, target_id)

@spec focus(state(), MingaEditor.Window.id()) :: state()

Focuses a window after saving and restoring its buffer cursor state.

focus_result(state, target_id)

@spec focus_result(state(), MingaEditor.Window.id()) :: focus_result()

Focuses a window and reports why an ownership-safe transition was rejected.

focus_surviving_window(state, windows, target_id)

@spec focus_surviving_window(
  state(),
  MingaEditor.State.Windows.t(),
  MingaEditor.Window.id()
) :: state()

Focuses a surviving window after the active split was removed.

remember_active_cursor(state)

@spec remember_active_cursor(state()) :: state()

Snapshots the active cursor only when the active window owns its buffer source.

remember_active_cursor_result(state)

@spec remember_active_cursor_result(state()) :: focus_result()

Snapshots the active cursor and reports ownership failures without changing state.

repair_focus(state, target_id)

@spec repair_focus(state(), MingaEditor.Window.id()) :: {:ok, state()} | :error

Repairs a window with a viable buffer or empty surface, then restores focus to it.

restore_focus(state, target_id)

@spec restore_focus(state(), MingaEditor.Window.id()) :: {:ok, state()} | :error

Restores focus without reading the outgoing window's buffer, for popup dismissal.