SearchSettings
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_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.
- set_at_word_boundaries(at_word_boundaries: bool) None
Change whether the search is done at word boundaries.
If
at_word_boundaries
isTrue
, a search match must start and end a word. The match can span multiple words. See alsostarts_word
andends_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
usesRegex
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
isNone
or is empty, the search will be disabled. A copy ofsearch_text
will be made, so you can safely freesearch_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
isTrue
, 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.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.
Fields
- class SearchSettings
- parent_instance