gi-gtksource-3.0.25: GtkSource bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GtkSource.Objects.SearchContext

Description

No description available in the introspection data.

Synopsis

Exported types

class (GObject o, IsDescendantOf SearchContext o) => IsSearchContext o Source #

Type class for types which can be safely cast to SearchContext, for instance with toSearchContext.

Instances

Instances details
(GObject o, IsDescendantOf SearchContext o) => IsSearchContext o Source # 
Instance details

Defined in GI.GtkSource.Objects.SearchContext

toSearchContext :: (MonadIO m, IsSearchContext o) => o -> m SearchContext Source #

Cast to SearchContext, for types for which this is known to be safe. For general casts, use castTo.

Methods

backward

searchContextBackward Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> m (Bool, TextIter, TextIter)

Returns: whether a match was found.

Deprecated: (Since version 3.22)Use searchContextBackward2 instead.

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.

Since: 3.10

backward2

searchContextBackward2 Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> m (Bool, TextIter, TextIter, Bool)

Returns: whether a match was found.

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.

The difference with searchContextBackward is that the hasWrappedAround out parameter has been added for convenience.

If the SearchSettings:wrap-around property is False, this function doesn't try to wrap around.

The hasWrappedAround out parameter is set independently of whether a match is found. So if this function returns False, hasWrappedAround will have the same value as the SearchSettings:wrap-around property.

Since: 3.22

backwardAsync

searchContextBackwardAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsCancellable b) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> Maybe b

cancellable: a Cancellable, or Nothing.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the operation is finished.

-> m () 

The asynchronous version of searchContextBackward2.

See the documentation of searchContextBackward2 for more details.

See the AsyncResult documentation to know how to use this function.

If the operation is cancelled, the callback will only be called if cancellable was not Nothing. searchContextBackwardAsync takes ownership of cancellable, so you can unref it after calling this function.

Since: 3.10

backwardFinish

searchContextBackwardFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsAsyncResult b) 
=> a

search: a SearchContext.

-> b

result: a AsyncResult.

-> m (TextIter, TextIter)

(Can throw GError)

Deprecated: (Since version 3.22)Use searchContextBackwardFinish2 instead.

Finishes a backward search started with searchContextBackwardAsync.

Since: 3.10

backwardFinish2

searchContextBackwardFinish2 Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsAsyncResult b) 
=> a

search: a SearchContext.

-> b

result: a AsyncResult.

-> m (TextIter, TextIter, Bool)

(Can throw GError)

Finishes a backward search started with searchContextBackwardAsync.

See the documentation of searchContextBackward2 for more details.

Since: 3.22

forward

searchContextForward Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> m (Bool, TextIter, TextIter)

Returns: whether a match was found.

Deprecated: (Since version 3.22)Use searchContextForward2 instead.

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.

Since: 3.10

forward2

searchContextForward2 Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> m (Bool, TextIter, TextIter, Bool)

Returns: whether a match was found.

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.

The difference with searchContextForward is that the hasWrappedAround out parameter has been added for convenience.

If the SearchSettings:wrap-around property is False, this function doesn't try to wrap around.

The hasWrappedAround out parameter is set independently of whether a match is found. So if this function returns False, hasWrappedAround will have the same value as the SearchSettings:wrap-around property.

Since: 3.22

forwardAsync

searchContextForwardAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsCancellable b) 
=> a

search: a SearchContext.

-> TextIter

iter: start of search.

-> Maybe b

cancellable: a Cancellable, or Nothing.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the operation is finished.

-> m () 

The asynchronous version of searchContextForward2.

See the documentation of searchContextForward2 for more details.

See the AsyncResult documentation to know how to use this function.

If the operation is cancelled, the callback will only be called if cancellable was not Nothing. searchContextForwardAsync takes ownership of cancellable, so you can unref it after calling this function.

Since: 3.10

forwardFinish

searchContextForwardFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsAsyncResult b) 
=> a

search: a SearchContext.

-> b

result: a AsyncResult.

-> m (TextIter, TextIter)

(Can throw GError)

Deprecated: (Since version 3.22)Use searchContextForwardFinish2 instead.

Finishes a forward search started with searchContextForwardAsync.

Since: 3.10

forwardFinish2

searchContextForwardFinish2 Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsAsyncResult b) 
=> a

search: a SearchContext.

-> b

result: a AsyncResult.

-> m (TextIter, TextIter, Bool)

(Can throw GError)

Finishes a forward search started with searchContextForwardAsync.

See the documentation of searchContextForward2 for more details.

Since: 3.22

getBuffer

searchContextGetBuffer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m Buffer

Returns: the associated buffer.

No description available in the introspection data.

Since: 3.10

getHighlight

searchContextGetHighlight Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m Bool

Returns: whether to highlight the search occurrences.

No description available in the introspection data.

Since: 3.10

getMatchStyle

searchContextGetMatchStyle Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m Style

Returns: the Style to apply on search matches.

No description available in the introspection data.

Since: 3.16

getOccurrencePosition

searchContextGetOccurrencePosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

matchStart: the start of the occurrence.

-> TextIter

matchEnd: the end of the occurrence.

-> m Int32

Returns: the position of the search occurrence. The first occurrence has the position 1 (not 0). Returns 0 if matchStart and matchEnd don't delimit an occurrence. Returns -1 if the position is not yet known.

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 matchStart and matchEnd don't delimit an occurrence.

Since: 3.10

getOccurrencesCount

searchContextGetOccurrencesCount Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m Int32

Returns: the total number of search occurrences, or -1 if unknown.

Gets the total number of search occurrences. If the buffer is not already fully scanned, the total number of occurrences is unknown, and -1 is returned.

Since: 3.10

getRegexError

searchContextGetRegexError Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m (Maybe GError)

Returns: the GError, or Nothing if the pattern is valid.

Regular expression patterns must follow certain rules. If SearchSettings:search-text breaks a rule, the error can be retrieved with this function. The error domain is G_REGEX_ERROR.

Free the return value with errorFree.

Since: 3.10

getSettings

searchContextGetSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> m SearchSettings

Returns: the search settings.

No description available in the introspection data.

Since: 3.10

new

searchContextNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsBuffer a, IsSearchSettings b) 
=> a

buffer: a Buffer.

-> Maybe b

settings: a SearchSettings, or Nothing.

-> m SearchContext

Returns: a new search context.

Creates a new search context, associated with buffer, and customized with settings. If settings is Nothing, a new SearchSettings object will be created, that you can retrieve with searchContextGetSettings.

Since: 3.10

replace

searchContextReplace Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

matchStart: the start of the match to replace.

-> TextIter

matchEnd: the end of the match to replace.

-> Text

replace: the replacement text.

-> Int32

replaceLength: the length of replace in bytes, or -1.

-> m ()

(Can throw GError)

Deprecated: (Since version 3.22)Use searchContextReplace2 instead.

Replaces a search match by another text. If matchStart and matchEnd doesn't correspond to a search match, False is returned.

For a regular expression replacement, you can check if replace is valid by calling regexCheckReplacement. The replace text can contain backreferences; read the regexReplace documentation for more details.

Since: 3.10

replace2

searchContextReplace2 Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> TextIter

matchStart: the start of the match to replace.

-> TextIter

matchEnd: the end of the match to replace.

-> Text

replace: the replacement text.

-> Int32

replaceLength: the length of replace in bytes, or -1.

-> m ()

(Can throw GError)

Replaces a search match by another text. If matchStart and matchEnd doesn't correspond to a search match, False is returned.

Unlike with searchContextReplace, the matchStart and matchEnd iters are revalidated to point to the replacement text boundaries.

For a regular expression replacement, you can check if replace is valid by calling regexCheckReplacement. The replace text can contain backreferences; read the regexReplace documentation for more details.

Since: 3.22

replaceAll

searchContextReplaceAll Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> Text

replace: the replacement text.

-> Int32

replaceLength: the length of replace in bytes, or -1.

-> m Word32

Returns: the number of replaced matches. (Can throw GError)

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 regexCheckReplacement. The replace text can contain backreferences; read the regexReplace documentation for more details.

Since: 3.10

setHighlight

searchContextSetHighlight Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a) 
=> a

search: a SearchContext.

-> Bool

highlight: the setting.

-> m () 

Enables or disables the search occurrences highlighting.

Since: 3.10

setMatchStyle

searchContextSetMatchStyle Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsStyle b) 
=> a

search: a SearchContext.

-> Maybe b

matchStyle: a Style, or Nothing.

-> m () 

Set the style to apply on search matches. If matchStyle is Nothing, default theme's scheme 'match-style' will be used. To enable or disable the search highlighting, use searchContextSetHighlight.

Since: 3.16

setSettings

searchContextSetSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchContext a, IsSearchSettings b) 
=> a

search: a SearchContext.

-> Maybe b

settings: the new SearchSettings, or Nothing.

-> m () 

Deprecated: (Since version 3.24)The SearchContext:settings property will become aconstruct-only property in a future version. Create a newtSearchContext instead, or change the SearchSettingsproperties. When the SearchContext:settings property will becomeconstruct-only, it will be possible to simplify some code that needed tolisten to the notify[settings](#g:signal:settings) signal.

Associate a SearchSettings with the search context. If settings is Nothing, a new one will be created.

The search context holds a reference to settings.

Since: 3.10

Properties

buffer

The Buffer associated to the search context.

Since: 3.10

constructSearchContextBuffer :: (IsSearchContext o, MonadIO m, IsBuffer a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “buffer” property. This is rarely needed directly, but it is used by new.

getSearchContextBuffer :: (MonadIO m, IsSearchContext o) => o -> m Buffer Source #

Get the value of the “buffer” property. When overloading is enabled, this is equivalent to

get searchContext #buffer

highlight

Highlight the search occurrences.

Since: 3.10

constructSearchContextHighlight :: (IsSearchContext o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “highlight” property. This is rarely needed directly, but it is used by new.

getSearchContextHighlight :: (MonadIO m, IsSearchContext o) => o -> m Bool Source #

Get the value of the “highlight” property. When overloading is enabled, this is equivalent to

get searchContext #highlight

setSearchContextHighlight :: (MonadIO m, IsSearchContext o) => o -> Bool -> m () Source #

Set the value of the “highlight” property. When overloading is enabled, this is equivalent to

set searchContext [ #highlight := value ]

matchStyle

A Style, or Nothing for theme's scheme default style.

Since: 3.16

clearSearchContextMatchStyle :: (MonadIO m, IsSearchContext o) => o -> m () Source #

Set the value of the “match-style” property to Nothing. When overloading is enabled, this is equivalent to

clear #matchStyle

constructSearchContextMatchStyle :: (IsSearchContext o, MonadIO m, IsStyle a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “match-style” property. This is rarely needed directly, but it is used by new.

getSearchContextMatchStyle :: (MonadIO m, IsSearchContext o) => o -> m Style Source #

Get the value of the “match-style” property. When overloading is enabled, this is equivalent to

get searchContext #matchStyle

setSearchContextMatchStyle :: (MonadIO m, IsSearchContext o, IsStyle a) => o -> a -> m () Source #

Set the value of the “match-style” property. When overloading is enabled, this is equivalent to

set searchContext [ #matchStyle := value ]

occurrencesCount

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.

Since: 3.10

getSearchContextOccurrencesCount :: (MonadIO m, IsSearchContext o) => o -> m Int32 Source #

Get the value of the “occurrences-count” property. When overloading is enabled, this is equivalent to

get searchContext #occurrencesCount

regexError

If the regex search pattern doesn't follow all the rules, this property will be set. If the pattern is valid, the value is Nothing.

Free with errorFree.

Since: 3.10

getSearchContextRegexError :: (MonadIO m, IsSearchContext o) => o -> m (Ptr ()) Source #

Get the value of the “regex-error” property. When overloading is enabled, this is equivalent to

get searchContext #regexError

settings

The SearchSettings associated to the search context.

Since: 3.10

clearSearchContextSettings :: (MonadIO m, IsSearchContext o) => o -> m () Source #

Set the value of the “settings” property to Nothing. When overloading is enabled, this is equivalent to

clear #settings

constructSearchContextSettings :: (IsSearchContext o, MonadIO m, IsSearchSettings a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “settings” property. This is rarely needed directly, but it is used by new.

getSearchContextSettings :: (MonadIO m, IsSearchContext o) => o -> m SearchSettings Source #

Get the value of the “settings” property. When overloading is enabled, this is equivalent to

get searchContext #settings

setSearchContextSettings :: (MonadIO m, IsSearchContext o, IsSearchSettings a) => o -> a -> m () Source #

Set the value of the “settings” property. When overloading is enabled, this is equivalent to

set searchContext [ #settings := value ]