MingaEditor.State.Search (Minga v0.1.0)

Copy Markdown View Source

Groups search-related fields from EditorState.

Tracks the last search pattern and direction (for n/N repeat), the pending project-wide search query (read off the editor path by the project search picker source), and the complete GUI search session.

Summary

Types

Retained authoritative GUI search session, including inactive sessions.

t()

Functions

Accepts a source-owned generation only for the exact live search revision.

Installs an exact line-local incremental index update.

Checks whether a completed build still targets the exact live search revision.

Accepts a complete native query edit only for the active session and a newer sequence.

Targets the active GUI session at a buffer and marks its build pending.

Dismisses the GUI search toolbar.

Records an explicit asynchronous search failure for the exact live request.

Starts a fresh GUI search session while preserving its query and options.

Returns the active GUI query options.

Returns the stable query revision for the active GUI search session.

Returns whether the GUI search toolbar is active.

Returns a ready generation only at the exact active buffer revision.

Invalidates the accepted revision and retains prior results only for pending display.

Records the last search pattern and direction.

Records just the last search pattern (keeps existing direction).

Returns the bounded renderer projection without copying the index.

Sets just the last search direction.

Stores the pending project-wide search query for the async picker source.

Types

gui_search()

@type gui_search() :: MingaEditor.State.Search.Session.t()

Retained authoritative GUI search session, including inactive sessions.

t()

@type t() :: %MingaEditor.State.Search{
  gui_search: gui_search() | nil,
  last_direction: Minga.Editing.Search.direction(),
  last_pattern: String.t() | nil,
  project_query: String.t() | nil
}

Functions

accept_gui_generation(search, revision, buffer, generation)

@spec accept_gui_generation(
  t(),
  non_neg_integer(),
  pid(),
  Minga.Search.IndexGeneration.t()
) ::
  {:accepted, t()} | {:stale, t()}

Accepts a source-owned generation only for the exact live search revision.

accept_gui_incremental(search, generation)

@spec accept_gui_incremental(t(), Minga.Search.IndexGeneration.t()) :: t()

Installs an exact line-local incremental index update.

accepts_gui_generation?(search, revision, buffer)

@spec accepts_gui_generation?(t(), non_neg_integer(), pid()) :: boolean()

Checks whether a completed build still targets the exact live search revision.

apply_gui_search_edit(s, session_id, edit_seq, query, case_sensitive, whole_word, regex)

@spec apply_gui_search_edit(
  t(),
  non_neg_integer(),
  non_neg_integer(),
  String.t(),
  boolean(),
  boolean(),
  boolean()
) :: {:accepted, t()} | {:stale, t()}

Accepts a complete native query edit only for the active session and a newer sequence.

begin_gui_build(search, buffer)

@spec begin_gui_build(t(), pid()) :: t()

Targets the active GUI session at a buffer and marks its build pending.

dismiss_gui_search(s)

@spec dismiss_gui_search(t()) :: t()

Dismisses the GUI search toolbar.

fail_gui_search(search, revision, buffer, reason)

@spec fail_gui_search(t(), non_neg_integer(), pid(), String.t()) ::
  {:accepted, t()} | {:stale, t()}

Records an explicit asynchronous search failure for the exact live request.

focus_gui_search(s, replace_mode)

@spec focus_gui_search(t(), boolean()) :: t()

Starts a fresh GUI search session while preserving its query and options.

gui_options(search)

@spec gui_options(t()) :: Minga.Editing.Search.search_opts()

Returns the active GUI query options.

gui_query_revision(search)

@spec gui_query_revision(t()) :: non_neg_integer()

Returns the stable query revision for the active GUI search session.

gui_search_active?(search)

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

Returns whether the GUI search toolbar is active.

ready_gui_generation(search, buffer, revision)

@spec ready_gui_generation(t(), pid(), {non_neg_integer(), non_neg_integer()}) ::
  {:ok, Minga.Search.IndexGeneration.t()} | :stale

Returns a ready generation only at the exact active buffer revision.

rebuild_gui_search(search, delta)

@spec rebuild_gui_search(t(), Minga.Buffer.EditDelta.t() | nil) :: t()

Invalidates the accepted revision and retains prior results only for pending display.

record(s, pattern, direction)

@spec record(t(), String.t(), Minga.Editing.Search.direction()) :: t()

Records the last search pattern and direction.

record_pattern(s, pattern)

@spec record_pattern(t(), String.t()) :: t()

Records just the last search pattern (keeps existing direction).

render_snapshot(search, buffer, cursor)

@spec render_snapshot(t(), pid() | nil, Minga.Editing.Search.position()) ::
  MingaEditor.State.Search.Projection.t()

Returns the bounded renderer projection without copying the index.

set_last_direction(s, direction)

@spec set_last_direction(t(), Minga.Editing.Search.direction()) :: t()

Sets just the last search direction.

set_project_query(s, query)

@spec set_project_query(t(), String.t()) :: t()

Stores the pending project-wide search query for the async picker source.