SearchSettings

class SearchSettings(**properties: Any)

Superclasses: Object

Search settings.

A GtkSourceSearchSettings object represents the settings of a search. The search settings can be associated with one or several SearchContext’s.

Constructors

class SearchSettings
classmethod new() SearchSettings

Creates a new search settings object.

Methods

class SearchSettings
get_at_word_boundaries() bool
get_case_sensitive() bool
get_regex_enabled() bool
get_search_text() str | None

Gets the text to search.

The return value must not be freed.

You may be interested to call utils_escape_search_text after this function.

get_visible_only() bool

Added in version 5.12.

get_wrap_around() bool
set_at_word_boundaries(at_word_boundaries: bool) None

Change whether the search is done at word boundaries.

If at_word_boundaries is True, a search match must start and end a word. The match can span multiple words. See also starts_word and ends_word.

Parameters:

at_word_boundaries – the setting.

set_case_sensitive(case_sensitive: bool) None

Enables or disables the case sensitivity for the search.

Parameters:

case_sensitive – the setting.

set_regex_enabled(regex_enabled: bool) None

Enables or disables whether to search by regular expressions.

If enabled, the search_text property contains the pattern of the regular expression.

SearchContext uses Regex when regex search is enabled. See the Regular expression syntax page in the GLib reference manual.

Parameters:

regex_enabled – the setting.

set_search_text(search_text: str | None = None) None

Sets the text to search.

If search_text is None or is empty, the search will be disabled. A copy of search_text will be made, so you can safely free search_text after a call to this function.

You may be interested to call utils_unescape_search_text before this function.

Parameters:

search_text – the nul-terminated text to search, or None to disable the search.

set_visible_only(visible_only: bool) None

Enables or disables whether to exclude invisible text from the search.

If enabled, only visible text will be searched. A search match may have invisible text interspersed.

Added in version 5.12.

Parameters:

visible_only – the setting.

set_wrap_around(wrap_around: bool) None

Enables or disables the wrap around search.

If wrap_around is True, the forward search continues at the beginning of the buffer if no search occurrences are found. Similarly, the backward search continues to search at the end of the buffer.

Parameters:

wrap_around – the setting.

Properties

class SearchSettings
props.at_word_boundaries: bool

If True, a search match must start and end a word. The match can span multiple words.

props.case_sensitive: bool

Whether the search is case sensitive.

props.regex_enabled: bool

Search by regular expressions with search_text as the pattern.

props.search_text: str

A search string, or None if the search is disabled.

If the regular expression search is enabled, search_text is the pattern.

props.visible_only: bool

Exclude invisible text from the search. A search match may have invisible text interspersed.

Added in version 5.12.

props.wrap_around: bool

For a forward search, continue at the beginning of the buffer if no search occurrence is found. For a backward search, continue at the end of the buffer.

Fields

class SearchSettings
parent_instance