GtkSource.SearchSettings

g GObject.Object GObject.Object GtkSource.SearchSettings GtkSource.SearchSettings GObject.Object->GtkSource.SearchSettings

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

get_at_word_boundaries ()

get_case_sensitive ()

get_regex_enabled ()

get_search_text ()

get_visible_only ()

get_wrap_around ()

set_at_word_boundaries (at_word_boundaries)

set_case_sensitive (case_sensitive)

set_regex_enabled (regex_enabled)

set_search_text (search_text)

set_visible_only (visible_only)

set_wrap_around (wrap_around)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

at-word-boundaries

bool

r/w/c

Search at word boundaries

case-sensitive

bool

r/w/c

Case sensitive

regex-enabled

bool

r/w/c

Whether to search by regular expression

search-text

str

r/w/c

The text to search

visible-only

bool

r/w/c

Whether to exclude invisible text from the search

wrap-around

bool

r/w/c

Wrap around

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class GtkSource.SearchSettings(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GtkSource.SearchSettingsClass

Search settings.

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

classmethod new()
Returns:

a new search settings object.

Return type:

GtkSource.SearchSettings

Creates a new search settings object.

get_at_word_boundaries()
Returns:

whether to search at word boundaries.

Return type:

bool

get_case_sensitive()
Returns:

whether the search is case sensitive.

Return type:

bool

get_regex_enabled()
Returns:

whether to search by regular expressions.

Return type:

bool

get_search_text()
Returns:

the text to search, or None if the search is disabled.

Return type:

str or None

Gets the text to search.

The return value must not be freed.

You may be interested to call [func`utils_escape_search_text`] after this function.

get_visible_only()
Returns:

whether to exclude invisible text from the search.

Return type:

bool

New in version 5.12.

get_wrap_around()
Returns:

whether to wrap around the search.

Return type:

bool

set_at_word_boundaries(at_word_boundaries)
Parameters:

at_word_boundaries (bool) – the setting.

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 [method`Gtk`.TextIter.starts_word] and [method`Gtk`.TextIter.ends_word].

set_case_sensitive(case_sensitive)
Parameters:

case_sensitive (bool) – the setting.

Enables or disables the case sensitivity for the search.

set_regex_enabled(regex_enabled)
Parameters:

regex_enabled (bool) – the setting.

Enables or disables whether to search by regular expressions.

If enabled, the [property`SearchSettings`:py:data::search-text<GtkSource.SearchSettings.props.search_text>] property contains the pattern of the regular expression.

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

set_search_text(search_text)
Parameters:

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

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 [func`utils_unescape_search_text`] before this function.

set_visible_only(visible_only)
Parameters:

visible_only (bool) – the setting.

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.

New in version 5.12.

set_wrap_around(wrap_around)
Parameters:

wrap_around (bool) – the setting.

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.

Property Details

GtkSource.SearchSettings.props.at_word_boundaries
Name:

at-word-boundaries

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

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

GtkSource.SearchSettings.props.case_sensitive
Name:

case-sensitive

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Whether the search is case sensitive.

GtkSource.SearchSettings.props.regex_enabled
Name:

regex-enabled

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Search by regular expressions with [property`SearchSettings`:py:data::search-text<GtkSource.SearchSettings.props.search_text>] as the pattern.

GtkSource.SearchSettings.props.search_text
Name:

search-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

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

If the regular expression search is enabled, [property`SearchSettings`:py:data::search-text<GtkSource.SearchSettings.props.search_text>] is the pattern.

GtkSource.SearchSettings.props.visible_only
Name:

visible-only

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

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

New in version 5.12.

GtkSource.SearchSettings.props.wrap_around
Name:

wrap-around

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

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.