Class: GtkSource::SearchContext
- Inherits:
-
Object
- Object
- GtkSource::SearchContext
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#backward(iter, match_start, match_end, has_wrapped_around) ⇒ Boolean
Synchronous backward search.
-
#backward_async(iter, cancellable, callback, user_data) ⇒ nil
The asynchronous version of [methodSearchContext.backward].
-
#backward_finish(result, match_start, match_end, has_wrapped_around) ⇒ Boolean
Finishes a backward search started with [methodSearchContext.backward_async].
-
#buffer ⇒ GtkSource::Buffer
The [classBuffer] associated to the search context.
-
#buffer=(buffer) ⇒ GtkSource::Buffer
The [classBuffer] associated to the search context.
-
#forward(iter, match_start, match_end, has_wrapped_around) ⇒ Boolean
Synchronous forward search.
-
#forward_async(iter, cancellable, callback, user_data) ⇒ nil
The asynchronous version of [methodSearchContext.forward].
-
#forward_finish(result, match_start, match_end, has_wrapped_around) ⇒ Boolean
Finishes a forward search started with [methodSearchContext.forward_async].
-
#get_occurrence_position(match_start, match_end) ⇒ Integer
Gets the position of a search occurrence.
-
#highlight ⇒ Boolean
Whether to highlight the search occurrences.
-
#highlight=(highlight) ⇒ Boolean
Highlight the search occurrences.
-
#highlight? ⇒ Boolean
Highlight the search occurrences.
-
#initialize(buffer, settings) ⇒ GtkSource::SearchContext
constructor
Creates a new search context, associated with buffer, and customized with settings.
-
#match_style ⇒ GtkSource::Style
A [classStyle], or nil for theme's scheme default style.
-
#match_style=(match_style) ⇒ GtkSource::Style
A [classStyle], or nil for theme's scheme default style.
-
#occurrences_count ⇒ Integer
The total number of search occurrences.
-
#occurrences_count=(occurrences_count) ⇒ Integer
The total number of search occurrences.
-
#regex_error ⇒ GLib::Error
If the regex search pattern doesn't follow all the rules, this #GError property will be set.
-
#regex_error=(regex_error) ⇒ GLib::Error
If the regex search pattern doesn't follow all the rules, this #GError property will be set.
-
#replace(match_start, match_end, replace, replace_length) ⇒ Boolean
Replaces a search match by another text.
-
#replace_all(replace, replace_length) ⇒ Integer
Replaces all search matches by another text.
-
#settings ⇒ GtkSource::SearchSettings
The [classSearchSettings] associated to the search context.
-
#settings=(settings) ⇒ GtkSource::SearchSettings
The [classSearchSettings] associated to the search context.
Constructor Details
#initialize(buffer, settings) ⇒ GtkSource::SearchContext
Creates a new search context, associated with buffer, and customized with settings.
If settings is nil, a new [classSearchSettings] object will be created, that you can retrieve with [methodSearchContext.get_settings].
Instance Method Details
#backward(iter, match_start, match_end, has_wrapped_around) ⇒ Boolean
Synchronous backward search.
It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.
If the [propertySearchSettings:wrap-around] property is false, this function doesn't try to wrap around.
The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns false, has_wrapped_around will have the same value as the [propertySearchSettings:wrap-around] property.
#backward_async(iter, cancellable, callback, user_data) ⇒ nil
The asynchronous version of [methodSearchContext.backward].
See the [ifaceGio.AsyncResult] documentation to know how to use this function.
If the operation is cancelled, the callback will only be called if cancellable was not nil. The method takes ownership of cancellable, so you can unref it after calling this function.
#backward_finish(result, match_start, match_end, has_wrapped_around) ⇒ Boolean
Finishes a backward search started with [methodSearchContext.backward_async].
See the documentation of [methodSearchContext.backward] for more details.
#buffer ⇒ GtkSource::Buffer
The [classBuffer] associated to the search context.
#buffer=(buffer) ⇒ GtkSource::Buffer
The [classBuffer] associated to the search context.
#forward(iter, match_start, match_end, has_wrapped_around) ⇒ Boolean
Synchronous forward search.
It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.
If the [propertySearchSettings:wrap-around] property is false, this function doesn't try to wrap around.
The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns false, has_wrapped_around will have the same value as the [propertySearchSettings:wrap-around] property.
#forward_async(iter, cancellable, callback, user_data) ⇒ nil
The asynchronous version of [methodSearchContext.forward].
See the [ifaceGio.AsyncResult] documentation to know how to use this function.
If the operation is cancelled, the callback will only be called if cancellable was not nil. The method takes ownership of cancellable, so you can unref it after calling this function.
#forward_finish(result, match_start, match_end, has_wrapped_around) ⇒ Boolean
Finishes a forward search started with [methodSearchContext.forward_async].
See the documentation of [methodSearchContext.forward] for more details.
#get_occurrence_position(match_start, match_end) ⇒ Integer
Gets the position of a search occurrence.
If the buffer is not already fully scanned, the position may be unknown, and -1 is returned. If 0 is returned, it means that this part of the buffer has already been scanned, and that match_start and match_end don't delimit an occurrence. position 1 (not 0). Returns 0 if match_start and match_end don't delimit an occurrence. Returns -1 if the position is not yet known.
#highlight ⇒ Boolean
Returns whether to highlight the search occurrences.
#highlight=(highlight) ⇒ Boolean
Highlight the search occurrences.
#highlight? ⇒ Boolean
Highlight the search occurrences.
#match_style ⇒ GtkSource::Style
A [classStyle], or nil for theme's scheme default style.
#match_style=(match_style) ⇒ GtkSource::Style
A [classStyle], or nil for theme's scheme default style.
#occurrences_count ⇒ Integer
The total number of search occurrences. If the search is disabled, the value is 0. If the buffer is not already fully scanned, the value is -1.
#occurrences_count=(occurrences_count) ⇒ Integer
The total number of search occurrences. If the search is disabled, the value is 0. If the buffer is not already fully scanned, the value is -1.
#regex_error ⇒ GLib::Error
If the regex search pattern doesn't follow all the rules, this #GError property will be set. If the pattern is valid, the value is nil.
Free with [methodGLib.Error.free].
#regex_error=(regex_error) ⇒ GLib::Error
If the regex search pattern doesn't follow all the rules, this #GError property will be set. If the pattern is valid, the value is nil.
Free with [methodGLib.Error.free].
#replace(match_start, match_end, replace, replace_length) ⇒ Boolean
Replaces a search match by another text. If match_start and match_end doesn't correspond to a search match, false is returned.
match_start and match_end iters are revalidated to point to the replacement text boundaries.
For a regular expression replacement, you can check if replace is valid by calling [funcGLib.Regex.check_replacement]. The replace text can contain backreferences.
#replace_all(replace, replace_length) ⇒ Integer
Replaces all search matches by another text.
It is a synchronous function, so it can block the user interface.
For a regular expression replacement, you can check if replace is valid by calling [funcGLib.Regex.check_replacement]. The replace text can contain backreferences.
#settings ⇒ GtkSource::SearchSettings
The [classSearchSettings] associated to the search context.
This property is construct-only since version 4.0.
#settings=(settings) ⇒ GtkSource::SearchSettings
The [classSearchSettings] associated to the search context.
This property is construct-only since version 4.0.