示例#1
0
static gboolean
ide_editor_frame__replace_key_press_event (IdeEditorFrame *self,
                                           GdkEventKey    *event,
                                           GtkSearchEntry *entry)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_IS_SEARCH_ENTRY (entry));

  switch (event->keyval)
    {
    case GDK_KEY_Escape:
      ide_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "exit-search", NULL);
      return GDK_EVENT_STOP;

    case GDK_KEY_KP_Enter:
    case GDK_KEY_Return:
      ide_widget_action (GTK_WIDGET (self->search_frame), "search-entry", "replace", NULL);
      return GDK_EVENT_STOP;

    case GDK_KEY_Down:
      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
      return GDK_EVENT_STOP;

    case GDK_KEY_Up:
      ide_widget_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
      return GDK_EVENT_STOP;

    default:
      break;
    }

  return GDK_EVENT_PROPAGATE;
}
示例#2
0
static void
check_replace_text (IdeEditorFrame *self)
{
  GtkSourceSearchContext *search_context;
  GtkSourceSearchSettings *search_settings;
  g_autoptr(GError) error = NULL;
  PangoAttrList *attrs;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  search_context = ide_source_view_get_search_context (self->source_view);
  search_settings = gtk_source_search_context_get_settings (search_context);

  attrs = pango_attr_list_new ();

  /*
   * If the replace expression is invalid, add a white squiggly underline;
   * otherwise remove it.
   */
  if (gtk_source_search_settings_get_regex_enabled (search_settings))
    {
      const gchar *replace_text;

      replace_text = gtk_entry_get_text (GTK_ENTRY (self->replace_entry));

      if (!g_regex_check_replacement (replace_text, NULL, &error))
        {
          pango_attr_list_insert (attrs, pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
          pango_attr_list_insert (attrs, pango_attr_underline_color_new (65535, 65535, 65535));
        }
    }

  gtk_entry_set_attributes (GTK_ENTRY (self->replace_entry), attrs);
  pango_attr_list_unref (attrs);
}
示例#3
0
static void
ide_editor_frame_actions_replace_confirm (GSimpleAction *action,
                                          GVariant      *state,
                                          gpointer       user_data)
{
  IdeEditorFrame *self = user_data;
  g_autofree const gchar **strv = NULL;
  gsize array_length;

  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (state != NULL);
  g_assert (g_variant_is_of_type (state, G_VARIANT_TYPE_STRING_ARRAY));

  strv = g_variant_get_strv (state, &array_length);
  g_assert (array_length >= 2);

  gtk_entry_set_text (GTK_ENTRY (self->search_entry), strv[0]);
  gtk_entry_set_text (GTK_ENTRY (self->replace_entry), strv[1]);

  gtk_widget_show (GTK_WIDGET (self->replace_entry));
  gtk_widget_show (GTK_WIDGET (self->replace_button));
  gtk_widget_show (GTK_WIDGET (self->replace_all_button));

  /* increment pending_replace_confirm so that search_revealer_on_child_revealed_changed
   * will know to go to the next search result (the occurrence only stays selected after
   * search_entry has been mapped).
   */
  self->pending_replace_confirm++;

  gtk_revealer_set_reveal_child (self->search_revealer, TRUE);

  gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
}
示例#4
0
static void
ide_editor_frame_add_search_actions (IdeEditorFrame *self,
                                     GActionGroup   *group)
{
  GPropertyAction *prop_action;
  GtkSourceSearchContext *search_context;
  GtkSourceSearchSettings *search_settings;

  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (G_IS_ACTION_GROUP (group));

  search_context = ide_source_view_get_search_context (self->source_view);
  search_settings = gtk_source_search_context_get_settings (search_context);

  prop_action = g_property_action_new ("change-case-sensitive", search_settings, "case-sensitive");
  g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (prop_action));
  g_object_unref (prop_action);

  prop_action = g_property_action_new ("change-word-boundaries", search_settings, "at-word-boundaries");
  g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (prop_action));
  g_object_unref (prop_action);

  prop_action = g_property_action_new ("change-regex-enabled", search_settings, "regex-enabled");
  g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (prop_action));
  g_object_unref (prop_action);

  prop_action = g_property_action_new ("change-wrap-around", search_settings, "wrap-around");
  g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (prop_action));
  g_object_unref (prop_action);
}
示例#5
0
static void
on_regex_error_changed (IdeEditorFrame         *self,
                        GParamSpec             *pspec,
                        GtkSourceSearchContext *search_context)
{
  g_autoptr(GError) error = NULL;
  PangoAttrList *attrs;

  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_SOURCE_IS_SEARCH_CONTEXT (search_context));

  /*
   * If the regular expression is invalid, add a white squiggly underline;
   * otherwise remove it.
   */
  attrs = pango_attr_list_new ();
  error = gtk_source_search_context_get_regex_error (search_context);

  if (error != NULL)
    {
      pango_attr_list_insert (attrs, pango_attr_underline_new (PANGO_UNDERLINE_ERROR));
      pango_attr_list_insert (attrs, pango_attr_underline_color_new (65535, 65535, 65535));
    }

  gtk_entry_set_attributes (GTK_ENTRY (self->search_entry), attrs);
  pango_attr_list_unref (attrs);

  update_replace_actions_sensitivity (self);
}
示例#6
0
/**
 * ide_editor_frame_get_source_view:
 *
 * Gets the #IdeEditorFrame:document property.
 *
 * Returns: (transfer none) (nullable): An #IdeSourceView or %NULL.
 */
IdeSourceView *
ide_editor_frame_get_source_view (IdeEditorFrame *self)
{
  g_return_val_if_fail (IDE_IS_EDITOR_FRAME (self), NULL);

  return self->source_view;
}
示例#7
0
void
ide_editor_frame_actions_init (IdeEditorFrame *self)
{
  GSimpleActionGroup *group;
  GAction *action;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  group = g_simple_action_group_new ();
  g_action_map_add_action_entries (G_ACTION_MAP (group), IdeEditorFrameActions,
                                   G_N_ELEMENTS (IdeEditorFrameActions), self);
  gtk_widget_insert_action_group (GTK_WIDGET (self), "frame", G_ACTION_GROUP (group));
  g_object_unref (group);

  group = g_simple_action_group_new ();
  g_action_map_add_action_entries (G_ACTION_MAP (group), IdeEditorFrameSearchActions,
                                   G_N_ELEMENTS (IdeEditorFrameSearchActions), self);

  /* Disable replace and replace-all by default; they should only be enabled
   * when the corresponding operations would make sense.
   */
  action = g_action_map_lookup_action (G_ACTION_MAP (group), "replace");
  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
  action = g_action_map_lookup_action (G_ACTION_MAP (group), "replace-all");
  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);

  gtk_widget_insert_action_group (GTK_WIDGET (self->search_frame), "search-entry", G_ACTION_GROUP (group));
  g_object_unref (group);
}
示例#8
0
static gboolean
ide_editor_frame_get_show_map (IdeEditorFrame *self)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));

  return (self->source_map != NULL);
}
示例#9
0
static void
ide_editor_frame_set_position_label (IdeEditorFrame *self,
                                     const gchar    *text)
{
  g_return_if_fail (IDE_IS_EDITOR_FRAME (self));

  if (!text || !*text)
    {
      if (self->search_entry_tag)
        {
          gd_tagged_entry_remove_tag (self->search_entry, self->search_entry_tag);
          g_clear_object (&self->search_entry_tag);
        }
      return;
    }

  if (!self->search_entry_tag)
    {
      self->search_entry_tag = gd_tagged_entry_tag_new ("");
      gd_tagged_entry_add_tag (self->search_entry, self->search_entry_tag);
      gd_tagged_entry_tag_set_style (self->search_entry_tag,
                                     "gb-search-entry-occurrences-tag");
    }

  gd_tagged_entry_tag_set_label (self->search_entry_tag, text);
}
示例#10
0
static void
ide_editor_frame_animate_map (IdeEditorFrame *self,
                              gboolean        visible)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));

  gtk_revealer_set_reveal_child (self->map_revealer, visible);
}
示例#11
0
static void
ide_editor_frame_show_map (IdeEditorFrame *self,
                           IdeSourceMap   *source_map)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (IDE_IS_SOURCE_MAP (source_map));

  ide_editor_frame_animate_map (self, TRUE);
}
示例#12
0
static void
ide_editor_frame_actions_replace (GSimpleAction *action,
                                  GVariant      *state,
                                  gpointer       user_data)
{
  IdeEditorFrame *self = user_data;
  GtkSourceSearchContext *search_context;
  GtkSourceSearchSettings *search_settings;
  const gchar *replace_text;
  gchar *unescaped_replace_text;
  const gchar *search_text;
  GError *error = NULL;
  GtkTextIter start;
  GtkTextIter end;
  GtkTextBuffer *buffer;
  gint occurrence_position;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  search_context = ide_source_view_get_search_context (self->source_view);
  g_assert (search_context != NULL);
  search_settings = gtk_source_search_context_get_settings (search_context);
  search_text = gtk_source_search_settings_get_search_text (search_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_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));
  gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
  occurrence_position = gtk_source_search_context_get_occurrence_position (search_context, &start, &end);

  if (occurrence_position > 0)
    {
      /* Temporarily disable updating the search position label to prevent flickering */
      g_signal_handler_block (buffer, self->cursor_moved_handler);

      gtk_source_search_context_replace2 (search_context, &start, &end, unescaped_replace_text, -1, &error);

      /* Re-enable updating the search position label. The next-search-result action
       * below will cause it to update. */
      g_signal_handler_unblock (buffer, self->cursor_moved_handler);

      if (error != NULL)
        {
          g_warning ("%s", error->message);
          g_clear_error (&error);
        }

      ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);
    }

  g_free (unescaped_replace_text);
}
示例#13
0
static void
on_regex_enabled_changed (IdeEditorFrame          *self,
                          GParamSpec              *pspec,
                          GtkSourceSearchSettings *search_settings)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_SOURCE_IS_SEARCH_SETTINGS (search_settings));

  check_replace_text (self);
}
示例#14
0
static void
on_search_text_changed (IdeEditorFrame          *self,
                        GParamSpec              *pspec,
                        GtkSourceSearchSettings *search_settings)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_SOURCE_IS_SEARCH_SETTINGS (search_settings));

  update_replace_actions_sensitivity (self);
}
示例#15
0
static void
ide_editor_view_grab_focus (GtkWidget *widget)
{
  IdeEditorView *self = (IdeEditorView *)widget;

  g_assert (IDE_IS_EDITOR_VIEW (self));
  g_assert (IDE_IS_EDITOR_FRAME (self->last_focused_frame));

  gtk_widget_grab_focus (GTK_WIDGET (self->last_focused_frame->source_view));
}
示例#16
0
static void
update_replace_actions_sensitivity (IdeEditorFrame *self)
{
  GtkSourceSearchContext *search_context;
  GtkSourceSearchSettings *search_settings;
  GtkTextBuffer *buffer;
  GtkTextIter start;
  GtkTextIter end;
  const gchar *search_text;
  const gchar *replace_text;
  gint pos;
  gint count;
  gboolean enable_replace;
  gboolean enable_replace_all;
  gboolean replace_regex_valid;
  g_autoptr(GError) regex_error = NULL;
  g_autoptr(GError) replace_regex_error = NULL;
  GActionGroup *group;
  GAction *replace_action;
  GAction *replace_all_action;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  search_context = ide_source_view_get_search_context (self->source_view);
  search_settings = gtk_source_search_context_get_settings (search_context);
  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));
  gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), &start, &end);
  replace_text = gtk_entry_get_text (GTK_ENTRY (self->replace_entry));

  /* Gather enough info to determine if Replace or Replace All would make sense */
  search_text = gtk_entry_get_text (GTK_ENTRY (self->search_entry));
  pos = gtk_source_search_context_get_occurrence_position (search_context, &start, &end);
  count = gtk_source_search_context_get_occurrences_count (search_context);
  regex_error = gtk_source_search_context_get_regex_error (search_context);
  replace_regex_valid = gtk_source_search_settings_get_regex_enabled (search_settings) ?
                        g_regex_check_replacement (replace_text, NULL, &replace_regex_error) :
                        TRUE;

  enable_replace = (!ide_str_empty0 (search_text) &&
                    regex_error == NULL &&
                    replace_regex_valid &&
                    pos > 0);

  enable_replace_all = (!ide_str_empty0 (search_text) &&
                        regex_error == NULL &&
                        replace_regex_valid &&
                        count > 0);

  group = gtk_widget_get_action_group (GTK_WIDGET (self->search_frame), "search-entry");
  replace_action = g_action_map_lookup_action (G_ACTION_MAP (group), "replace");
  replace_all_action = g_action_map_lookup_action (G_ACTION_MAP (group), "replace-all");

  g_simple_action_set_enabled (G_SIMPLE_ACTION (replace_action), enable_replace);
  g_simple_action_set_enabled (G_SIMPLE_ACTION (replace_all_action), enable_replace_all);
}
示例#17
0
static void
ide_editor_frame_actions_select_all (GSimpleAction *action,
                                     GVariant      *state,
                                     gpointer       user_data)
{
  IdeEditorFrame *self = user_data;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  gtk_editable_select_region (GTK_EDITABLE (self->search_entry), 0, -1);
}
示例#18
0
/**
 * ide_editor_frame_get_document:
 *
 * Gets the #IdeEditorFrame:document property.
 *
 * Returns: (transfer none) (nullable): An #IdeBuffer or %NULL.
 */
IdeBuffer *
ide_editor_frame_get_document (IdeEditorFrame *self)
{
  GtkTextBuffer *buffer;

  g_return_val_if_fail (IDE_IS_EDITOR_FRAME (self), NULL);

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));

  return IDE_IS_BUFFER (buffer) ? IDE_BUFFER (buffer) : NULL;
}
示例#19
0
static void
ide_editor_frame_actions_paste_clipboard (GSimpleAction *action,
                                          GVariant      *state,
                                          gpointer       user_data)
{
  IdeEditorFrame *self = user_data;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  gtk_editable_paste_clipboard (GTK_EDITABLE (self->search_entry));
}
示例#20
0
static void
on_replace_text_changed (IdeEditorFrame *self,
                         GParamSpec     *pspec,
                         GtkSearchEntry *replace_entry)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_IS_SEARCH_ENTRY (replace_entry));

  check_replace_text (self);
  update_replace_actions_sensitivity (self);
}
示例#21
0
static void
ide_editor_frame_on_search_occurrences_notify (IdeEditorFrame          *self,
                                               GParamSpec              *pspec,
                                               GtkSourceSearchContext  *search_context)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_SOURCE_IS_SEARCH_CONTEXT (search_context));

  ide_editor_frame_update_search_position_label (self);

  update_replace_actions_sensitivity (self);
}
示例#22
0
static void
ide_editor_frame_hide_map (IdeEditorFrame *self,
                           IdeSourceMap   *source_map)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (IDE_IS_SOURCE_MAP (source_map));

  /* ignore hide request if auto-hide is disabled */
  if ((self->source_map != NULL) && !self->auto_hide_map)
    return;

  ide_editor_frame_animate_map (self, FALSE);
}
示例#23
0
static void
ide_editor_frame_set_show_ruler (IdeEditorFrame *self,
                                 gboolean        show_ruler)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));

  if (show_ruler != self->show_ruler)
    {
      self->show_ruler = show_ruler;
      ide_editor_frame_update_ruler (self);
      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SHOW_RULER]);
    }
}
示例#24
0
static void
ide_editor_frame_set_auto_hide_map (IdeEditorFrame *self,
                                    gboolean        auto_hide_map)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));

  auto_hide_map = !!auto_hide_map;

  if (auto_hide_map != self->auto_hide_map)
    {
      self->auto_hide_map = auto_hide_map;
      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_AUTO_HIDE_MAP]);
    }
}
示例#25
0
static void
ide_editor_frame_actions_toggle_search_options (GSimpleAction *action,
                                                GVariant      *state,
                                                gpointer       user_data)
{
  IdeEditorFrame *self = user_data;
  gboolean visible;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  visible = !gtk_widget_get_visible (GTK_WIDGET (self->search_options));

  gtk_widget_set_visible (GTK_WIDGET (self->search_options), visible);
}
示例#26
0
static void
ide_editor_frame_actions_previous_search_result (GSimpleAction *action,
                                                GVariant      *variant,
                                                gpointer       user_data)
{
  IdeEditorFrame *self = user_data;

  g_assert (IDE_IS_EDITOR_FRAME (self));

  ide_source_view_set_rubberband_search (self->source_view, FALSE);

  IDE_SOURCE_VIEW_GET_CLASS (self->source_view)->move_search
    (self->source_view, GTK_DIR_UP, FALSE, TRUE, TRUE, FALSE, -1);
}
示例#27
0
static void
ide_editor_frame_update_search_position_label (IdeEditorFrame *self)
{
  GtkSourceSearchContext *search_context;
  GtkStyleContext *context;
  GtkTextBuffer *buffer;
  GtkTextIter begin;
  GtkTextIter end;
  const gchar *search_text;
  gchar *text;
  gint count;
  gint pos;

  g_return_if_fail (IDE_IS_EDITOR_FRAME (self));

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));
  search_context = ide_source_view_get_search_context (self->source_view);
  gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
  pos = gtk_source_search_context_get_occurrence_position (search_context, &begin, &end);
  count = gtk_source_search_context_get_occurrences_count (search_context);

  if ((pos == -1) || (count == -1))
    {
      /*
       * We are not yet done scanning the buffer.
       * We will be updated when we know more, so just hide it for now.
       */
      ide_editor_frame_set_position_label (self, NULL);
      return;
    }

  context = gtk_widget_get_style_context (GTK_WIDGET (self->search_entry));
  search_text = gtk_entry_get_text (GTK_ENTRY (self->search_entry));

  /* We use our own error class because we don't want to colide with styling
   * from GTK+ themes.
   */
  if ((count == 0) && !ide_str_empty0 (search_text))
    gtk_style_context_add_class (context, "search-missing");
  else
    gtk_style_context_remove_class (context, "search-missing");

  text = g_strdup_printf (_("%u of %u"), pos, count);
  ide_editor_frame_set_position_label (self, text);
  g_free (text);
}
示例#28
0
static void
ide_editor_frame__source_view_focus_location (IdeEditorFrame    *self,
                                              IdeSourceLocation *location,
                                              IdeSourceView     *source_view)
{
  IdeWorkbench *workbench;
  IdePerspective *editor;

  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (location != NULL);
  g_assert (IDE_IS_SOURCE_VIEW (source_view));

  workbench = ide_widget_get_workbench (GTK_WIDGET (self));
  editor = ide_workbench_get_perspective_by_name (workbench, "editor");

  ide_editor_perspective_focus_location (IDE_EDITOR_PERSPECTIVE (editor), location);
}
示例#29
0
static void
ide_editor_frame__search_populate_popup (IdeEditorFrame *self,
                                         GtkWidget      *popup,
                                         GdTaggedEntry  *entry)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_IS_WIDGET (popup));
  g_assert (GD_IS_TAGGED_ENTRY (entry));

  if (GTK_IS_MENU_SHELL (popup))
    {
      GMenu *menu;
      GActionGroup *group;
      GAction *action;
      GtkEntryBuffer *buffer;
      GtkClipboard *clipboard;
      gboolean clipboard_contains_text;
      gboolean entry_has_selection;

      group = gtk_widget_get_action_group (GTK_WIDGET (self->search_frame), "search-entry");

      menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "ide-editor-frame-search-menu");
      gtk_menu_shell_bind_model (GTK_MENU_SHELL (popup), G_MENU_MODEL (menu), NULL, TRUE);

      clipboard = gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD);
      clipboard_contains_text = gtk_clipboard_wait_is_text_available (clipboard);

      action = g_action_map_lookup_action (G_ACTION_MAP (group), "paste-clipboard");
      g_simple_action_set_enabled (G_SIMPLE_ACTION (action), clipboard_contains_text);

      entry_has_selection = gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), NULL, NULL);

      action = g_action_map_lookup_action (G_ACTION_MAP (group), "cut-clipboard");
      g_simple_action_set_enabled (G_SIMPLE_ACTION (action), entry_has_selection);

      action = g_action_map_lookup_action (G_ACTION_MAP (group), "copy-clipboard");
      g_simple_action_set_enabled (G_SIMPLE_ACTION (action), entry_has_selection);

      action = g_action_map_lookup_action (G_ACTION_MAP (group), "delete-selection");
      g_simple_action_set_enabled (G_SIMPLE_ACTION (action), entry_has_selection);

      action = g_action_map_lookup_action (G_ACTION_MAP (group), "select-all");
      buffer = gtk_entry_get_buffer (GTK_ENTRY (self->search_entry));
      g_simple_action_set_enabled (G_SIMPLE_ACTION (action), gtk_entry_buffer_get_length (buffer) > 0);
    }
}
示例#30
0
static void
search_revealer_on_child_revealed_changed (IdeEditorFrame *self,
                                           GParamSpec     *pspec,
                                           GtkRevealer    *search_revealer)
{
  g_assert (IDE_IS_EDITOR_FRAME (self));
  g_assert (GTK_IS_REVEALER (search_revealer));

  if (self->pending_replace_confirm == 0 ||
      !gtk_revealer_get_child_revealed (search_revealer))
    return;

  ide_widget_action (GTK_WIDGET (self), "frame", "next-search-result", NULL);

  self->pending_replace_confirm--;

  gtk_widget_grab_focus (GTK_WIDGET (self->replace_button));
}