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), cached project-wide search results for the picker, and the GUI search toolbar state (active, flags, replace mode).

Summary

Types

GUI search toolbar state. Non-nil means the toolbar is active.

t()

Functions

Activates the GUI search toolbar with the given flags.

Dismisses the GUI search toolbar.

Returns whether the GUI search toolbar is active.

Records the last search pattern and direction.

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

Sets replace mode on the GUI search toolbar.

Sets just the last search direction.

Replaces the cached project search results.

Updates the GUI search toolbar flags. Activates the toolbar with replace_mode: false if not already active.

Types

gui_search()

@type gui_search() :: %{
  replace_mode: boolean(),
  case_sensitive: boolean(),
  whole_word: boolean(),
  regex: boolean()
}

GUI search toolbar state. Non-nil means the toolbar is active.

t()

@type t() :: %MingaEditor.State.Search{
  gui_search: gui_search() | nil,
  last_direction: Minga.Editing.Search.direction(),
  last_pattern: String.t() | nil,
  project_results: [Minga.Project.ProjectSearch.match()]
}

Functions

activate_gui_search(s, case_sensitive, whole_word, regex)

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

Activates the GUI search toolbar with the given flags.

dismiss_gui_search(s)

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

Dismisses the GUI search toolbar.

gui_search_active?(search)

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

Returns whether the GUI search toolbar is active.

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).

set_gui_replace_mode(s, replace_mode)

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

Sets replace mode on the GUI search toolbar.

set_last_direction(s, direction)

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

Sets just the last search direction.

set_project_results(s, results)

@spec set_project_results(t(), [Minga.Project.ProjectSearch.match()]) :: t()

Replaces the cached project search results.

update_gui_search_flags(s, case_sensitive, whole_word, regex)

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

Updates the GUI search toolbar flags. Activates the toolbar with replace_mode: false if not already active.