Raxol.Terminal.SearchManager (Raxol v2.0.1)

View Source

Manages terminal search operations including text search, pattern matching, and search history. This module is responsible for handling all search-related operations in the terminal.

Summary

Functions

Adds a pattern to the search history. Returns the updated emulator.

Clears the search history. Returns the updated emulator.

Clears the current search. Returns the updated emulator.

Finds the next match in the search. Returns {:ok, updated_emulator, match} or {:error, reason}.

Finds the previous match in the search. Returns {:ok, updated_emulator, match} or {:error, reason}.

Gets all matches in the current search. Returns the list of matches.

Gets the search buffer instance. Returns the search buffer.

Gets the current match index. Returns the current index.

Gets the total number of matches. Returns the number of matches.

Gets the current search options. Returns the current options.

Gets the current search pattern. Returns the current pattern.

Gets the search history. Returns the list of recent search patterns.

Highlights all matches in the current view. Returns the updated emulator.

Sets the search options. Returns the updated emulator.

Starts a new search with the given pattern. Returns {:ok, updated_emulator} or {:error, reason}.

Updates the search buffer instance. Returns the updated emulator.

Functions

add_to_history(emulator, pattern)

Adds a pattern to the search history. Returns the updated emulator.

clear_history(emulator)

Clears the search history. Returns the updated emulator.

clear_search(emulator)

Clears the current search. Returns the updated emulator.

find_next(emulator)

Finds the next match in the search. Returns {:ok, updated_emulator, match} or {:error, reason}.

find_previous(emulator)

Finds the previous match in the search. Returns {:ok, updated_emulator, match} or {:error, reason}.

get_all_matches(emulator)

Gets all matches in the current search. Returns the list of matches.

get_buffer(emulator)

Gets the search buffer instance. Returns the search buffer.

get_current_index(emulator)

@spec get_current_index(Raxol.Terminal.Emulator.t()) :: integer()

Gets the current match index. Returns the current index.

get_match_count(emulator)

@spec get_match_count(Raxol.Terminal.Emulator.t()) :: non_neg_integer()

Gets the total number of matches. Returns the number of matches.

get_options(emulator)

Gets the current search options. Returns the current options.

get_pattern(emulator)

@spec get_pattern(Raxol.Terminal.Emulator.t()) :: String.t() | nil

Gets the current search pattern. Returns the current pattern.

get_search_history(emulator)

@spec get_search_history(Raxol.Terminal.Emulator.t()) :: [String.t()]

Gets the search history. Returns the list of recent search patterns.

highlight_matches(emulator)

@spec highlight_matches(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.Emulator.t()

Highlights all matches in the current view. Returns the updated emulator.

set_options(emulator, options)

Sets the search options. Returns the updated emulator.

start_search(emulator, pattern)

@spec start_search(Raxol.Terminal.Emulator.t(), String.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Starts a new search with the given pattern. Returns {:ok, updated_emulator} or {:error, reason}.

update_buffer(emulator, buffer)

Updates the search buffer instance. Returns the updated emulator.