Top | ![]() |
![]() |
![]() |
![]() |
gboolean | active | Read |
gboolean | at-word-boundaries | Read / Write |
gboolean | case-sensitive | Read / Write |
IdeEditorSearchSelect | extend-selection | Read / Write |
guint | match-count | Read |
guint | match-position | Read |
gboolean | regex-enabled | Read / Write |
guint | repeat | Read / Write |
gchar * | replacement-text | Read / Write |
gboolean | reverse | Read / Write |
gchar * | search-text | Read / Write |
GtkSourceView * | view | Read / Write / Construct Only |
gchar * | visible | Read / Write |
GEnum ├── IdeEditorSearchDirection ╰── IdeEditorSearchSelect GObject ╰── IdeEditorSearch
The IdeEditorSearch object manages the search features associated with a single IdeEditorView (and it's view of the underlying text buffer).
This object is meant to help reduce the number of layers performing search on the underlying buffer as well as track highlighting based on focus, performance considerations, and directional movements in a unified manner.
Additionally, it provides an addin layer to highlight similar words when then buffer selection changes.
IdeEditorSearch *
ide_editor_search_new (GtkSourceView *view
);
Creates a new IdeEditorSearch instance for the GtkSourceView. You should only create one of these per IdeEditorView.
Since: 3.28
gboolean
ide_editor_search_get_active (IdeEditorSearch *self
);
Gets the "active" property.
The IdeEditorSearch is considered active if there is a search context loaded and the search text is not empty.
void ide_editor_search_set_case_sensitive (IdeEditorSearch *self
,gboolean case_sensitive
);
See also: “case-sensitive”
Since: 3.28
gboolean
ide_editor_search_get_case_sensitive (IdeEditorSearch *self
);
Gets if the search should be case sensitive.
Since: 3.28
IdeEditorSearchSelect
ide_editor_search_get_extend_selection
(IdeEditorSearch *self
);
Gets the "extend-selection" property.
This property determines if the selection should be extended and how when moving between search results.
Since: 3.28
void ide_editor_search_set_extend_selection (IdeEditorSearch *self
,IdeEditorSearchSelect extend_selection
);
gboolean
ide_editor_search_get_reverse (IdeEditorSearch *self
);
Checks if search movements should be reversed for relative movements such
as IDE_EDITOR_SEARCH_NEXT
and IDE_EDITOR_SEARCH_PREVIOUS
.
This might be used when performing searches such as vim's # or * search operators. After that movements like n or N need to swap directions.
Since: 3.28
void ide_editor_search_set_reverse (IdeEditorSearch *self
,gboolean reverse
);
Sets the "reverse" property.
This is used to alter the direction for relative search movements.
IDE_EDITOR_SEARCH_NEXT
and IDE_EDITOR_SEARCH_PREVIOUS
will swap
directions so that IDE_EDITOR_SEARCH_PREVIOUS
will search forwards
in the buffer and IDE_EDITOR_SEARCH_NEXT
wills earch backwards.
Since: 3.28
void ide_editor_search_set_search_text (IdeEditorSearch *self
,const gchar *search_text
);
See also: “search-text”
Since: 3.28
const gchar *
ide_editor_search_get_search_text (IdeEditorSearch *self
);
Gets the search-text currently being searched.
Since: 3.28
gboolean ide_editor_search_get_search_text_invalid (IdeEditorSearch *self
,guint *invalid_begin
,guint *invalid_end
,GError **error
);
Checks to see if the search text contains invalid contents, such as an invalid regex.
self |
||
invalid_begin |
a begin location for the invalid range. |
[nullable][out] |
invalid_end |
an end location for the invalid range. |
[nullable][out] |
TRUE
if the search text contains invalid content. If TRUE
,
then invalid_begin
and invalid_end
is set.
Since: 3.28
void ide_editor_search_set_visible (IdeEditorSearch *self
,gboolean visible
);
Sets the visibility of the search results. You might want to disable the visibility of search results when the user has requested them to be dismissed.
This will allow the user to still make search movements based on the previous search request, and re-enable visibility upon doing so.
Since: 3.28
gboolean
ide_editor_search_get_visible (IdeEditorSearch *self
);
Gets the “visible” property. This is true if the current search text should be highlighted in the editor.
Since: 3.28
void ide_editor_search_set_regex_enabled (IdeEditorSearch *self
,gboolean regex_enabled
);
See also: “regex-enabled”
Since: 3.28
gboolean
ide_editor_search_get_regex_enabled (IdeEditorSearch *self
);
Gets the “regex-enabled” property. This is true if the search text can contain regular expressions supported by GRegex.
Since: 3.28
void ide_editor_search_set_replacement_text (IdeEditorSearch *self
,const gchar *replacement_text
);
This sets the text to use when performing search and replace. See
ide_editor_search_replace()
or ide_editor_search_replace_all()
to
perform one or more replacements.
If “regex-enabled” is set, then you may reference regex groups from the regex in “search-text”.
Since: 3.28
const gchar *
ide_editor_search_get_replacement_text
(IdeEditorSearch *self
);
Gets the “replacement-text” property. This is the text
that will be used when calling ide_editor_search_replace()
or
ide_editor_search_replace_all()
.
Since: 3.28
gboolean ide_editor_search_get_replacement_text_invalid (IdeEditorSearch *self
,guint *invalid_begin
,guint *invalid_end
);
void ide_editor_search_set_at_word_boundaries (IdeEditorSearch *self
,gboolean at_word_boundaries
);
See also: gtk_source_search_settings_set_word_boundaries()
Since: 3.28
gboolean
ide_editor_search_get_at_word_boundaries
(IdeEditorSearch *self
);
Gets the “at-word-boundaries” property.
Since: 3.28
guint
ide_editor_search_get_repeat (IdeEditorSearch *self
);
Gets the “repeat” property containing the number of times to perform a move. A value of 1 performs a single move. A value of 2 performs a second move after the first.
A value of zero indicates the property is unset and a single move will be performed.
void ide_editor_search_set_repeat (IdeEditorSearch *self
,guint repeat
);
Sets the repeat count. A repeat
value of 0 indicates that the value
is unset. When unset, the default value of 1 is used.
See also: ide_editor_search_get_repeat()
Since: 3.28
guint
ide_editor_search_get_match_count (IdeEditorSearch *self
);
Gets the number of matches currently found in the editor. This will update as new matches are found while scanning the buffer.
Since: 3.28
guint
ide_editor_search_get_match_position (IdeEditorSearch *self
);
Gets the match position of the cursor within the buffer. If the cursor is within a match, this will be a 1-based index will update as new matches are found while scanning the buffer.
Since: 3.28
void ide_editor_search_move (IdeEditorSearch *self
,IdeEditorSearchDirection direction
);
This moves the insertion cursor in the buffer to the next match based
upon direction
.
If direction is IDE_EDITOR_SEARCH_BACKWARD
, the search will stop
at the beginning of the buffer.
If direction is IDE_EDITOR_SEARCH_FORWARD
, the search will stop
at the end of the buffer.
If direction is IDE_EDITOR_SEARCH_NEXT
, it will automatically wrap
around to the beginning of the buffer after reaching the end of the
buffer.
If direction is IDE_EDITOR_SEARCH_PREVIOUS
, the search will
automatically wrap around to the end of the buffer once the beginning
of the buffer has been reached.
Since: 3.28
void
ide_editor_search_replace (IdeEditorSearch *self
);
Replaces the next occurrance of a search result with the value of “replacement-text”.
Since: 3.28
void
ide_editor_search_replace_all (IdeEditorSearch *self
);
Replaces all the occurrances of “search-text” with the value of “replacement-text”.
Since: 3.28
void
ide_editor_search_begin_interactive (IdeEditorSearch *self
);
This function is used to track when the user begin doing an interactive search, which is one where they are typing the search query.
Tracking this behavior is useful because it allows the editor to "rubberband", which is to say it can scan forward to the first search result automatically, and then snap back to the previous location if the search is aborted.
Since: 3.28
void
ide_editor_search_end_interactive (IdeEditorSearch *self
);
This function completes an interactive search previously performed
with ide_editor_search_begin_interactive()
.
This should be called when the user has left the search controls, as it might allow the editor to restore positioning back to the previous editor location from before the interactive search began.
Since: 3.28
“active”
property “active” gboolean
The "active" property is TRUE
when their is an active search
in progress.
Flags: Read
Default value: FALSE
Since: 3.28
“at-word-boundaries”
property “at-word-boundaries” gboolean
The "at-word-boundaries" property specifies if the search-text must only be matched starting from the beginning of a word.
Flags: Read / Write
Default value: FALSE
Since: 3.28
“case-sensitive”
property “case-sensitive” gboolean
The "case-sensitive" property specifies if the search text should be case sensitive.
Flags: Read / Write
Default value: FALSE
Since: 3.28
“extend-selection”
property “extend-selection” IdeEditorSearchSelect
The "extend-selection" property specifies that the selection within the editor should be extended as the user navigates between search results.
Flags: Read / Write
Default value: IDE_EDITOR_SEARCH_SELECT_NONE
Since: 3.28
“match-count”
property “match-count” guint
The "match-count" property contains the number of matches that have been discovered. This is reset to zeor when the IdeEditorSearch determines it can destroy it's GtkSourceSearchContext.
Generally, you should only rely on it's accuracy after calling
ide_editor_search_begin_interactive()
and before calling
ide_editor_search_end_interactive()
.
Flags: Read
Default value: 0
Since: 3.28
“match-position”
property “match-position” guint
The "match-position" property contains the position within the discovered search results for which the insertion cursor is placed.
This value starts from 1, and 0 indicates that the insertion cursor is not placed within the a search result.
Flags: Read
Default value: 0
Since: 3.28
“regex-enabled”
property “regex-enabled” gboolean
The "regex-enabled" property determines if GRegex should be used to scan for the “search-text”. Doing so allows the user to search using common regex values such as "foo.*bar". It also allows for capture groups to be used in replacement text.
Flags: Read / Write
Default value: FALSE
Since: 3.28
“repeat”
property “repeat” guint
The number of times to repeat a move operation when calling
ide_editor_search_move()
. This allows for stateful moves when as
might be necessary when activating keybindings.
This property will be cleared after an attempt to move.
Flags: Read / Write
Default value: 0
Since: 3.28
“replacement-text”
property “replacement-text” gchar *
The "replacement-text" property determines the text to be used when
performing search and replace with ide_editor_search_replace()
or
ide_editor_search_replace_all()
.
If “regex-enabled” is TRUE
, then the user may use
references to capture groups specified in “search-text”.
Flags: Read / Write
Default value: NULL
Since: 3.28
“reverse”
property “reverse” gboolean
The "reverse" property determines if relative directions should be switched, so next is backward, and previous is forward.
Flags: Read / Write
Default value: FALSE
Since: 3.28
“search-text”
property “search-text” gchar *
The "search-text" property contains the text to search within the buffer.
If the “regex-enabled” property is set to TRUE
, then
the user may use regular expressions supported by GRegex to scan the
buffer. They may also specify capture groups to use in search and
replace.
Flags: Read / Write
Default value: NULL
Since: 3.28
“view”
property“view” GtkSourceView *
The "view" property is the underlying GtkSourceView that is being searched. This must be set when creating the IdeEditorSearch and may not be changed after construction.
Flags: Read / Write / Construct Only
Since: 3.28
“visible”
property “visible” gchar *
The "visible" property is used to specify if the search results should be highlighted in the buffer. Generally, you'll want this off while the interactive search is hidden as it allows the IdeEditorSearch to perform various optimizations.
However, some cases, such as Vim search movements, may want to show the search highlights, but are not within an interactive search.
Flags: Read / Write
Default value: NULL
Since: 3.28