Commit 77ce4721 authored by Christian Hergert's avatar Christian Hergert

editor: add new IdeEditorSearch abstraction

This attempts to unify a bunch of our editor search. We still need to
adjust keybindings and other bits from the sourceview.

In particular, we want to reduce how many GtkSourceSearchContext we have
active at any given time. Also, we want better control over visibility of
search results based on interactive search.
parent 6cee5d35
......@@ -24,6 +24,7 @@
#include "editor/ide-editor-perspective.h"
#include "editor/ide-editor-properties.h"
#include "editor/ide-editor-search.h"
#include "editor/ide-editor-search-bar.h"
#include "editor/ide-editor-sidebar.h"
#include "editor/ide-editor-view-addin.h"
......@@ -63,8 +64,7 @@ struct _IdeEditorView
DzlBindingGroup *buffer_bindings;
DzlSignalGroup *buffer_signals;
GtkSourceSearchSettings *search_settings;
GtkSourceSearchContext *search_context;
IdeEditorSearch *search;
GCancellable *destroy_cancellable;
......@@ -89,38 +89,10 @@ struct _IdeEditorView
guint show_map : 1;
};
struct _IdeEditorSearchBar
{
DzlBin parent_instance;
/* Owned references */
DzlSignalGroup *buffer_signals;
GtkSourceSearchContext *context;
DzlSignalGroup *context_signals;
GtkSourceSearchSettings *settings;
DzlSignalGroup *settings_signals;
GdTaggedEntryTag *search_entry_tag;
/* Template widgets */
GtkCheckButton *case_sensitive;
GtkButton *replace_all_button;
GtkButton *replace_button;
GtkSearchEntry *replace_entry;
GdTaggedEntry *search_entry;
GtkGrid *search_options;
GtkCheckButton *use_regex;
GtkCheckButton *whole_word;
GSettings *quick_highlight_settings;
guint quick_highlight_enabled : 1;
};
void _ide_editor_view_init_actions (IdeEditorView *self);
void _ide_editor_view_init_settings (IdeEditorView *self);
void _ide_editor_view_init_shortcuts (IdeEditorView *self);
void _ide_editor_view_update_actions (IdeEditorView *self);
void _ide_editor_search_bar_init_actions (IdeEditorSearchBar *self);
void _ide_editor_search_bar_init_shortcuts (IdeEditorSearchBar *self);
void _ide_editor_sidebar_set_open_pages (IdeEditorSidebar *self,
GListModel *open_pages);
......
/* ide-editor-search-bar-actions.c
*
* Copyright (C) 2017 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define G_LOG_DOMAIN "ide-editor-search-bar-actions"
#include <libgd/gd-tagged-entry.h>
#include "editor/ide-editor-search-bar.h"
#include "editor/ide-editor-private.h"
static void
ide_editor_search_bar_actions_toggle_search_options (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
IdeEditorSearchBar *self = user_data;
gboolean visible;
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
visible = !gtk_widget_get_visible (GTK_WIDGET (self->search_options));
gtk_widget_set_visible (GTK_WIDGET (self->search_options), visible);
}
static void
ide_editor_search_bar_actions_toggle_search_replace (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
IdeEditorSearchBar *self = user_data;
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
ide_editor_search_bar_set_replace_mode (self, !ide_editor_search_bar_get_replace_mode (self));
}
static void
ide_editor_search_bar_actions_replace (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
IdeEditorSearchBar *self = user_data;
g_autofree gchar *unescaped_replace_text = NULL;
g_autoptr(GError) error = NULL;
GtkSourceBuffer *buffer;
const gchar *replace_text;
const gchar *search_text;
GtkTextIter begin;
GtkTextIter end;
gint position;
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
if (self->settings == NULL || self->context == NULL)
return;
search_text = gtk_source_search_settings_get_search_text (self->settings);
replace_text = gtk_entry_get_text (GTK_ENTRY (self->replace_entry));
if (ide_str_empty0 (search_text) || replace_text == NULL)
return;
unescaped_replace_text = gtk_source_utils_unescape_search_text (replace_text);
buffer = gtk_source_search_context_get_buffer (self->context);
gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), &begin, &end);
position = gtk_source_search_context_get_occurrence_position (self->context, &begin, &end);
if (position > 0)
{
/* Temporarily disable updating the search position label to prevent flickering */
dzl_signal_group_block (self->buffer_signals);
gtk_source_search_context_replace2 (self->context, &begin, &end,
unescaped_replace_text, -1, &error);
/* Re-enable updating the search position label. The next-search-result action
* below will cause it to update. */
dzl_signal_group_unblock (self->buffer_signals);
if (error != NULL)
g_warning ("%s", error->message);
dzl_gtk_widget_action (GTK_WIDGET (self), "editor-view", "move-next-search-result", NULL);
}
}
static void
ide_editor_search_bar_actions_replace_all (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
IdeEditorSearchBar *self = user_data;
g_autofree gchar *unescaped_replace_text = NULL;
g_autoptr(GError) error = NULL;
const gchar *replace_text;
const gchar *search_text;
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
if (self->settings == NULL || self->context == NULL)
return;
search_text = gtk_source_search_settings_get_search_text (self->settings);
replace_text = gtk_entry_get_text (GTK_ENTRY (self->replace_entry));
if (ide_str_empty0 (search_text) || replace_text == NULL)
return;
unescaped_replace_text = gtk_source_utils_unescape_search_text (replace_text);
gtk_source_search_context_replace_all (self->context, unescaped_replace_text, -1, &error);
if (error != NULL)
g_warning ("%s", error->message);
}
static const GActionEntry search_bar_actions[] = {
{ "toggle-search-options", NULL, "b", "false",
ide_editor_search_bar_actions_toggle_search_options },
{ "toggle-search-replace", NULL, "b", "false",
ide_editor_search_bar_actions_toggle_search_replace },
{ "replace", ide_editor_search_bar_actions_replace },
{ "replace-all", ide_editor_search_bar_actions_replace_all },
};
void
_ide_editor_search_bar_init_actions (IdeEditorSearchBar *self)
{
g_autoptr(GSimpleActionGroup) actions = NULL;
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
actions = g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (actions),
search_bar_actions,
G_N_ELEMENTS (search_bar_actions),
self);
gtk_widget_insert_action_group (GTK_WIDGET (self), "search-bar", G_ACTION_GROUP (actions));
}
......@@ -18,9 +18,27 @@
#define G_LOG_DOMAIN "ide-editor-search-bar-shortcuts"
#include "editor/ide-editor-private.h"
#include "editor/ide-editor-search-bar.h"
static void
ide_editor_search_bar_shortcuts_activate_previous (GtkWidget *widget,
gpointer user_data)
{
IdeEditorSearchBar *self = user_data;
IdeEditorSearch *search;
g_assert (GTK_IS_WIDGET (widget));
g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
search = ide_editor_search_bar_get_search (self);
if (search != NULL)
{
ide_editor_search_move (search, IDE_EDITOR_SEARCH_PREVIOUS);
g_signal_emit_by_name (self, "stop-search");
}
}
void
_ide_editor_search_bar_init_shortcuts (IdeEditorSearchBar *self)
{
......@@ -28,15 +46,22 @@ _ide_editor_search_bar_init_shortcuts (IdeEditorSearchBar *self)
controller = dzl_shortcut_controller_find (GTK_WIDGET (self));
dzl_shortcut_controller_add_command_callback (controller,
"org.gnome.builder.editor.search-bar.activate-previous",
"<Shift>Return",
DZL_SHORTCUT_PHASE_BUBBLE,
ide_editor_search_bar_shortcuts_activate_previous,
self, NULL);
dzl_shortcut_controller_add_command_action (controller,
"org.gnome.builder.editor.search-bar.move-next",
"Down",
DZL_SHORTCUT_PHASE_BUBBLE,
"editor-view.move-next-search-result");
"editor-search.move-next");
dzl_shortcut_controller_add_command_action (controller,
"org.gnome.builder.editor.search-bar.move-previous",
"Up",
DZL_SHORTCUT_PHASE_BUBBLE,
"editor-view.move-previous-search-result");
"editor-search.move-previous");
}
This diff is collapsed.
......@@ -19,9 +19,9 @@
#pragma once
#include <dazzle.h>
#include <gtksourceview/gtksource.h>
#include "buffers/ide-buffer.h"
#include "sourceview/ide-source-view.h"
#include "editor/ide-editor-search.h"
G_BEGIN_DECLS
......@@ -29,15 +29,14 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (IdeEditorSearchBar, ide_editor_search_bar, IDE, EDITOR_SEARCH_BAR, DzlBin)
GtkWidget *ide_editor_search_bar_new (void);
void ide_editor_search_bar_set_search_text (IdeEditorSearchBar *self,
const gchar *word);
gboolean ide_editor_search_bar_get_replace_mode (IdeEditorSearchBar *self);
void ide_editor_search_bar_set_replace_mode (IdeEditorSearchBar *self,
gboolean replace_mode);
void ide_editor_search_bar_set_context (IdeEditorSearchBar *self,
GtkSourceSearchContext *context);
void ide_editor_search_bar_set_settings (IdeEditorSearchBar *self,
GtkSourceSearchSettings *settings);
IdeEditorSearch *ide_editor_search_bar_get_search (IdeEditorSearchBar *self);
void ide_editor_search_bar_set_search (IdeEditorSearchBar *self,
IdeEditorSearch *search);
gboolean ide_editor_search_bar_get_show_options (IdeEditorSearchBar *self);
void ide_editor_search_bar_set_show_options (IdeEditorSearchBar *self,
gboolean show_options);
gboolean ide_editor_search_bar_get_replace_mode (IdeEditorSearchBar *self);
void ide_editor_search_bar_set_replace_mode (IdeEditorSearchBar *self,
gboolean replace_mode);
G_END_DECLS
......@@ -12,14 +12,14 @@
<child>
<object class="GtkGrid">
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<child>
<object class="GdTaggedEntry" id="search_entry">
<property name="visible">true</property>
<property name="tag-close-visible">false</property>
<property name="can_focus">true</property>
<property name="can-focus">true</property>
<property name="hexpand">true</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">false</property>
......@@ -30,10 +30,27 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="search_text_error">
<property name="visible">false</property>
<property name="xalign">0.0</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="0.8333"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="width">3</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="replace_entry">
<property name="visible">false</property>
<property name="can_focus">true</property>
<property name="can-focus">true</property>
<property name="width-chars">20</property>
<property name="max-width-chars">30</property>
<property name="primary_icon_name">edit-find-replace-symbolic</property>
......@@ -42,28 +59,27 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="homogeneous">true</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="valign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="action-name">editor-view.move-previous-search-result</property>
<property name="action-name">editor-search.move-previous</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="receives_default">true</property>
<property name="can-focus">false</property>
<child>
<object class="GtkImage">
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="icon_name">go-up-symbolic</property>
<property name="icon_size">1</property>
</object>
......@@ -77,14 +93,13 @@
</child>
<child>
<object class="GtkButton">
<property name="action-name">editor-view.move-next-search-result</property>
<property name="action-name">editor-search.move-next</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="receives_default">true</property>
<property name="can-focus">false</property>
<child>
<object class="GtkImage">
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="icon_name">go-down-symbolic</property>
<property name="icon_size">1</property>
</object>
......@@ -105,49 +120,45 @@
<child>
<object class="GtkButton" id="replace_button">
<property name="label" translatable="yes">Replace</property>
<property name="action-name">search-bar.replace</property>
<property name="action-name">editor-search.replace</property>
<property name="visible">false</property>
<property name="can_focus">true</property>
<property name="receives_default">true</property>
<property name="can-focus">true</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="replace_all_button">
<property name="label" translatable="yes">Replace All</property>
<property name="action-name">search-bar.replace-all</property>
<property name="action-name">editor-search.replace-all</property>
<property name="visible">false</property>
<property name="can_focus">true</property>
<property name="receives_default">true</property>
<property name="can-focus">true</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="homogeneous">true</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="valign">center</property>
<property name="spacing">8</property>
<child>
<object class="GtkToggleButton">
<property name="action-name">search-bar.toggle-search-replace</property>
<property name="action-target">true</property>
<property name="active" bind-source="IdeEditorSearchBar" bind-property="replace-mode" bind-flags="sync-create|bidirectional"/>
<property name="tooltip-text" translatable="yes">Switch between Search and Search-and-Replace</property>
<property name="visible">true</property>
<property name="can_focus">true</property>
<property name="receives_default">true</property>
<property name="can-focus">true</property>
<property name="image_position">right</property>
<child>
<object class="GtkImage">
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="icon_name">edit-find-replace-symbolic</property>
</object>
</child>
......@@ -159,17 +170,16 @@
</packing>
</child>
<child>
<object class="GtkToggleButton">
<property name="action-name">search-bar.toggle-search-options</property>
<property name="action-target">true</property>
<object class="GtkToggleButton" id="show_options">
<property name="tooltip-text" translatable="yes">Show or hide search options such as case sensitivity</property>
<property name="focus-on-click">false</property>
<property name="visible">true</property>
<property name="can_focus">true</property>
<property name="receives_default">true</property>
<property name="can-focus">true</property>
<property name="active" bind-source="IdeEditorSearchBar" bind-property="show-options" bind-flags="sync-create|bidirectional"/>
<child>
<object class="GtkImage">
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="icon_name">emblem-system-symbolic</property>
</object>
</child>
......@@ -196,17 +206,16 @@
<child>
<object class="GtkGrid" id="search_options">
<property name="visible">false</property>
<property name="can_focus">false</property>
<property name="can-focus">false</property>
<property name="column_spacing">8</property>
<child>
<object class="GtkCheckButton" id="use_regex">
<property name="action-name">search-settings.regex-enabled</property>
<property name="label" translatable="yes">Regular expressions</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="receives_default">false</property>
<property name="can-focus">false</property>
<property name="focus-on-click">false</property>
<property name="xalign">0</property>
<property name="draw_indicator">true</property>
<property name="draw-indicator">true</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -215,13 +224,11 @@
</child>
<child>
<object class="GtkCheckButton" id="case_sensitive">
<property name="action-name">search-settings.case-sensitive</property>
<property name="label" translatable="yes">Case sensitive</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="receives_default">false</property>
<property name="can-focus">false</property>
<property name="xalign">0</property>
<property name="draw_indicator">true</property>
<property name="draw-indicator">true</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -230,13 +237,11 @@
</child>
<child>
<object class="GtkCheckButton" id="whole_word">
<property name="action-name">search-settings.at-word-boundaries</property>
<property name="label" translatable="yes">Match whole word only</property>
<property name="visible">true</property>
<property name="can_focus">false</property>
<property name="receives_default">false</property>
<property name="can-focus">false</property>
<property name="xalign">0</property>
<property name="draw_indicator">true</property>
<property name="draw-indicator">true</property>
</object>
<packing>
<property name="left_attach">2</property>
......
This diff is collapsed.
/* ide-editor-search.h
*
* Copyright (C) 2017 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <gtksourceview/gtksource.h>
G_BEGIN_DECLS
typedef enum
{
IDE_EDITOR_SEARCH_NEXT,
IDE_EDITOR_SEARCH_PREVIOUS,
IDE_EDITOR_SEARCH_FORWARD,
IDE_EDITOR_SEARCH_BACKWARD,
} IdeEditorSearchDirection;
#define IDE_TYPE_EDITOR_SEARCH (ide_editor_search_get_type())
G_DECLARE_FINAL_TYPE (IdeEditorSearch, ide_editor_search, IDE, EDITOR_SEARCH, GObject)
IdeEditorSearch *ide_editor_search_new (GtkSourceView *view);
void ide_editor_search_set_case_sensitive (IdeEditorSearch *self,
gboolean case_sensitive);
gboolean ide_editor_search_get_case_sensitive (IdeEditorSearch *self);
gboolean ide_editor_search_get_reverse (IdeEditorSearch *self);
void ide_editor_search_set_reverse (IdeEditorSearch *self,
gboolean reverse);
void ide_editor_search_set_search_text (IdeEditorSearch *self,
const gchar *search_text);
const gchar *ide_editor_search_get_search_text (IdeEditorSearch *self);
gboolean ide_editor_search_get_search_text_invalid (IdeEditorSearch *self,
guint *invalid_begin,
guint *invalid_end,
GError **error);
void ide_editor_search_set_visible (IdeEditorSearch *self,
gboolean visible);
gboolean ide_editor_search_get_visible (IdeEditorSearch *self);
void ide_editor_search_set_regex_enabled (IdeEditorSearch *self,
gboolean regex_enabled);
gboolean ide_editor_search_get_regex_enabled (IdeEditorSearch *self);
void ide_editor_search_set_replacement_text (IdeEditorSearch *self,
const gchar *replacement_text);
const gchar *ide_editor_search_get_replacement_text (IdeEditorSearch *self);
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);
gboolean ide_editor_search_get_at_word_boundaries (IdeEditorSearch *self);
gboolean ide_editor_search_get_busy (IdeEditorSearch *self);
guint ide_editor_search_get_match_count (IdeEditorSearch *self);
guint ide_editor_search_get_match_position (IdeEditorSearch *self);
void ide_editor_search_move (IdeEditorSearch *self,
IdeEditorSearchDirection direction);
void ide_editor_search_replace (IdeEditorSearch *self);
void ide_editor_search_replace_all (IdeEditorSearch *self);
void ide_editor_search_begin_interactive (IdeEditorSearch *self);
void ide_editor_search_end_interactive (IdeEditorSearch *self);
G_END_DECLS
......@@ -404,7 +404,7 @@ ide_editor_view_actions_find (GSimpleAction *action,
if (gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (self->buffer), &begin, &end))
{
g_autofree gchar *word = gtk_text_iter_get_slice (&begin, &end);
ide_editor_search_bar_set_search_text (self->search_bar, word);
ide_editor_search_set_search_text (self->search, word);
}
ide_editor_search_bar_set_replace_mode (self->search_bar, FALSE);
......@@ -427,7 +427,7 @@ ide_editor_view_actions_find_replace (GSimpleAction *action,
if (gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (self->buffer), &begin, &end))
{
g_autofree gchar *word = gtk_text_iter_get_slice (&begin, &end);
ide_editor_search_bar_set_search_text (self->search_bar, word);
ide_editor_search_set_search_text (self->search, word);
}
ide_editor_search_bar_set_replace_mode (self->search_bar, TRUE);
......
......@@ -37,6 +37,7 @@ enum {
PROP_0,
PROP_AUTO_HIDE_MAP,
PROP_BUFFER,
PROP_SEARCH,
PROP_SHOW_MAP,
PROP_VIEW,
N_PROPS
......@@ -534,7 +535,6 @@ search_revealer_notify_reveal_child (IdeEditorView *self,
GtkRevealer *revealer)
{
GtkSourceCompletion *completion;
GtkSourceSearchContext *view_search_context;
g_return_if_fail (IDE_IS_EDITOR_VIEW (self));
g_return_if_fail (pspec != NULL);
......@@ -544,45 +544,14 @@ search_revealer_notify_reveal_child (IdeEditorView *self,
if (!gtk_revealer_get_reveal_child (revealer))
{
/*
* Clear the context from the search bar so it doesn't try to
* keep updating various UI bits while the bar is not visible.
*/
ide_editor_search_bar_set_context (self->search_bar, NULL);
/*
* If there are no occurrences currently, just destroy the search context
* so that we can avoid tracking buffer changes.
*/
if (self->search_context != NULL &&
gtk_source_search_context_get_occurrences_count (self->search_context) <= 0)
g_clear_object (&self->search_context);
/*
* We might still need the search context so the user can move to the
* prev/next search result. However, we do not any longer need to have
* highlight enabled.
*/
if (self->search_context != NULL)
gtk_source_search_context_set_highlight (self->search_context, FALSE);
ide_editor_search_end_interactive (self->search);
/* Restore completion that we blocked below. */
gtk_source_completion_unblock_interactive (completion);
}
else
{
if (self->search_context == NULL)
self->search_context = g_object_new (GTK_SOURCE_TYPE_SEARCH_CONTEXT,
"buffer", self->buffer,
"settings", self->search_settings,
NULL);
gtk_source_search_context_set_highlight (self->search_context, TRUE);
ide_editor_search_bar_set_context (self->search_bar, self->search_context);
/* We need to hide the search highlight on the view context */
if (NULL != (view_search_context = ide_source_view_get_search_context (self->source_view)))
gtk_source_search_context_set_highlight (view_search_context, FALSE);
ide_editor_search_begin_interactive (self->search);
/*
* Block the completion while the search bar is set. It only
......@@ -676,7 +645,8 @@ ide_editor_view_constructed (GObject *object)
G_CALLBACK (search_revealer_notify_reveal_child),
self);
ide_editor_search_bar_set_settings (self->search_bar, self->search_settings);
self->search = ide_editor_search_new (GTK_SOURCE_VIEW (self->source_view));
ide_editor_search_bar_set_search (self->search_bar, self->search);
ide_editor_view_load_fonts (self);
ide_editor_view_update_map (self);
......@@ -698,8 +668,7 @@ ide_editor_view_destroy (GtkWidget *widget)
g_cancellable_cancel (self->destroy_cancellable);
g_clear_object (&self->destroy_cancellable);
g_clear_object (&self->search_settings);
g_clear_object (&self->search_context);
g_clear_object (&self->search);
g_clear_object (&self->editor_settings);
g_clear_object (&self->insight_settings);