[gnome-builder/wip/chergert/editorsearch: 7/7] editor: improve search movements



commit 1b252478817dbacc41f302fa3ea4cd56e3614b25
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 10 14:46:08 2017 -0700

    editor: improve search movements
    
    This allows for repeat and selection extensions based on
    something resembling inclusive/exclusive from vim. It's not
    exact, but it's about as good as we had before and much more
    maintainable.
    
    We still need to setup IdeEditorView to prefer these movements
    over those from IdeSourceView.

 src/libide/editor/ide-editor-search-bar.c |   39 +++-
 src/libide/editor/ide-editor-search.c     |  352 +++++++++++++++++++++++++++--
 src/libide/editor/ide-editor-search.h     |  106 ++++++----
 3 files changed, 425 insertions(+), 72 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-search-bar.c b/src/libide/editor/ide-editor-search-bar.c
index 0ab1870..6c68fc5 100644
--- a/src/libide/editor/ide-editor-search-bar.c
+++ b/src/libide/editor/ide-editor-search-bar.c
@@ -146,6 +146,34 @@ pacify_null_text (GBinding     *binding,
 }
 
 static void
+set_position_label (IdeEditorSearchBar *self,
+                    const gchar        *text)
+{
+  g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
+
+  if (dzl_str_empty0 (text))
+    {
+      if (self->search_entry_tag != NULL)
+        {
+          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 == NULL)
+    {
+      self->search_entry_tag = gd_tagged_entry_tag_new (text);
+      gd_tagged_entry_add_tag (self->search_entry, self->search_entry_tag);
+      gd_tagged_entry_tag_set_style (self->search_entry_tag, "search-occurrences-tag");
+      return;
+    }
+
+  gd_tagged_entry_tag_set_label (self->search_entry_tag, text);
+}
+
+static void
 ide_editor_search_bar_grab_focus (GtkWidget *widget)
 {
   IdeEditorSearchBar *self = (IdeEditorSearchBar *)widget;
@@ -222,15 +250,8 @@ search_entry_activate (IdeEditorSearchBar *self,
   g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
   g_assert (GD_IS_TAGGED_ENTRY (entry));
 
-  if (self->search == NULL)
-    return;
-
-  /* If we haven't yet advanced to the first search result, do so.
-   * Otherwise, don't jump the search result forward as that would
-   * be distracting to the user and non-obvious.
-   */
-  if (ide_editor_search_get_match_position (self->search) == 0)
-    ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_FORWARD);
+  if (self->search != NULL)
+    ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_NEXT);
 
   g_signal_emit (self, signals [STOP_SEARCH], 0);
 }
diff --git a/src/libide/editor/ide-editor-search.c b/src/libide/editor/ide-editor-search.c
index 8bbd81c..19e8114 100644
--- a/src/libide/editor/ide-editor-search.c
+++ b/src/libide/editor/ide-editor-search.c
@@ -59,9 +59,12 @@ struct _IdeEditorSearch
   guint                    match_count;
   guint                    match_position;
 
+  guint                    repeat;
+
   guint                    busy : 1;
   guint                    reverse : 1;
   guint                    visible : 1;
+  IdeEditorSearchSelect    extend_selection : 2;
 };
 
 enum {
@@ -69,9 +72,11 @@ enum {
   PROP_AT_WORD_BOUNDARIES,
   PROP_BUSY,
   PROP_CASE_SENSITIVE,
+  PROP_EXTEND_SELECTION,
   PROP_MATCH_COUNT,
   PROP_MATCH_POSITION,
   PROP_REGEX_ENABLED,
+  PROP_REPEAT,
   PROP_REPLACEMENT_TEXT,
   PROP_REVERSE,
   PROP_SEARCH_TEXT,
@@ -80,14 +85,14 @@ enum {
   N_PROPS
 };
 
-static void ide_editor_search_actions_move_next          (IdeEditorSearch *self,
-                                                          GVariant        *param);
-static void ide_editor_search_actions_move_previous      (IdeEditorSearch *self,
-                                                          GVariant        *param);
-static void ide_editor_search_actions_replace            (IdeEditorSearch *self,
-                                                          GVariant        *param);
-static void ide_editor_search_actions_replace_all        (IdeEditorSearch *self,
-                                                          GVariant        *param);
+static void ide_editor_search_actions_move_next     (IdeEditorSearch *self,
+                                                     GVariant        *param);
+static void ide_editor_search_actions_move_previous (IdeEditorSearch *self,
+                                                     GVariant        *param);
+static void ide_editor_search_actions_replace       (IdeEditorSearch *self,
+                                                     GVariant        *param);
+static void ide_editor_search_actions_replace_all   (IdeEditorSearch *self,
+                                                     GVariant        *param);
 
 DZL_DEFINE_ACTION_GROUP (IdeEditorSearch, ide_editor_search, {
   { "move-next", ide_editor_search_actions_move_next },
@@ -188,6 +193,10 @@ ide_editor_search_get_property (GObject    *object,
       g_value_set_boolean (value, ide_editor_search_get_case_sensitive (self));
       break;
 
+    case PROP_EXTEND_SELECTION:
+      g_value_set_enum (value, ide_editor_search_get_extend_selection (self));
+      break;
+
     case PROP_VIEW:
       g_value_set_object (value, self->view);
       break;
@@ -204,6 +213,10 @@ ide_editor_search_get_property (GObject    *object,
       g_value_set_boolean (value, ide_editor_search_get_regex_enabled (self));
       break;
 
+    case PROP_REPEAT:
+      g_value_set_uint (value, ide_editor_search_get_repeat (self));
+      break;
+
     case PROP_REPLACEMENT_TEXT:
       g_value_set_string (value, ide_editor_search_get_replacement_text (self));
       break;
@@ -247,6 +260,10 @@ ide_editor_search_set_property (GObject      *object,
       ide_editor_search_set_case_sensitive (self, g_value_get_boolean (value));
       break;
 
+    case PROP_EXTEND_SELECTION:
+      ide_editor_search_set_extend_selection (self, g_value_get_enum (value));
+      break;
+
     case PROP_SEARCH_TEXT:
       ide_editor_search_set_search_text (self, g_value_get_string (value));
       break;
@@ -259,6 +276,10 @@ ide_editor_search_set_property (GObject      *object,
       ide_editor_search_set_regex_enabled (self, g_value_get_boolean (value));
       break;
 
+    case PROP_REPEAT:
+      ide_editor_search_set_repeat (self, g_value_get_uint (value));
+      break;
+
     case PROP_REPLACEMENT_TEXT:
       ide_editor_search_set_replacement_text (self, g_value_get_string (value));
       break;
@@ -346,6 +367,23 @@ ide_editor_search_class_init (IdeEditorSearchClass *klass)
                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * IdeEditorSearch:extend-selection:
+   *
+   * The "extend-selection" property specifies that the selection within
+   * the editor should be extended as the user navigates between search
+   * results.
+   *
+   * Since: 3.28
+   */
+  properties [PROP_EXTEND_SELECTION] =
+    g_param_spec_enum ("extend-selection",
+                       "Extend Selection",
+                       "If the selection should be extended when moving through results",
+                       IDE_TYPE_EDITOR_SEARCH_SELECT,
+                       IDE_EDITOR_SEARCH_SELECT_NONE,
+                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * IdeEditorSearch:match-count:
    *
    * The "match-count" property contains the number of matches that have
@@ -380,6 +418,22 @@ ide_editor_search_class_init (IdeEditorSearchClass *klass)
                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * IdeEditorSearch:repeat:
+   *
+   * 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.
+   *
+   * Since: 3.28
+   */
+  properties [PROP_REPEAT] =
+    g_param_spec_uint ("repeat", NULL, NULL,
+                       0, G_MAXUINT, 0,
+                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * IdeEditorSearch:regex-enabled:
    *
    * The "regex-enabled" property determines if #GRegex should be used
@@ -1050,6 +1104,28 @@ ide_editor_search_get_match_position (IdeEditorSearch *self)
   return self->match_position;
 }
 
+static gboolean
+buffer_selection_contains (GtkTextBuffer *buffer,
+                           GtkTextIter   *iter)
+{
+  GtkTextIter begin;
+  GtkTextIter end;
+
+  g_assert (GTK_IS_TEXT_BUFFER (buffer));
+  g_assert (iter != NULL);
+
+  if (gtk_text_buffer_get_selection_bounds (buffer, &begin, &end))
+    {
+      gtk_text_iter_order (&begin, &end);
+
+      if (gtk_text_iter_compare (&begin, iter) <= 0 &&
+          gtk_text_iter_compare (&end, iter) >= 0)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 ide_editor_search_forward_cb (GObject      *object,
                               GAsyncResult *result,
@@ -1068,9 +1144,33 @@ ide_editor_search_forward_cb (GObject      *object,
       if (self->view != NULL)
         {
           GtkTextBuffer *buffer = gtk_text_iter_get_buffer (&begin);
+          GtkTextMark *insert = gtk_text_buffer_get_insert (buffer);
+
+          if (self->extend_selection != IDE_EDITOR_SEARCH_SELECT_NONE)
+            {
+              GtkTextIter *dest = &end;
+
+              if (buffer_selection_contains (buffer, &begin) &&
+                  self->extend_selection == IDE_EDITOR_SEARCH_SELECT_WITH_RESULT)
+                dest = &begin;
+
+              gtk_text_buffer_move_mark (buffer, insert, dest);
+            }
+          else
+            gtk_text_buffer_select_range (buffer, &begin, &end);
+
+          gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (self->view), insert, 0.0, TRUE, 1.0, 0.5);
 
-          gtk_text_buffer_select_range (buffer, &begin, &end);
-          gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (self->view), &begin, 0.0, TRUE, 1.0, 0.5);
+          if (self->repeat > 0)
+            {
+              self->repeat--;
+              gtk_source_search_context_forward_async (context,
+                                                       &end,
+                                                       NULL,
+                                                       ide_editor_search_forward_cb,
+                                                       g_object_ref (self));
+              g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REPEAT]);
+            }
         }
     }
 
@@ -1095,15 +1195,90 @@ ide_editor_search_backward_cb (GObject      *object,
       if (self->view != NULL)
         {
           GtkTextBuffer *buffer = gtk_text_iter_get_buffer (&begin);
+          GtkTextMark *insert = gtk_text_buffer_get_insert (buffer);
+
+          if (self->extend_selection != IDE_EDITOR_SEARCH_SELECT_NONE)
+            {
+              GtkTextIter *dest = &begin;
+
+              if (buffer_selection_contains (buffer, &begin) &&
+                  self->extend_selection == IDE_EDITOR_SEARCH_SELECT_WITH_RESULT)
+                dest = &end;
 
-          gtk_text_buffer_select_range (buffer, &begin, &end);
-          gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (self->view), &begin, 0.0, TRUE, 1.0, 0.5);
+              gtk_text_buffer_move_mark (buffer, insert, dest);
+            }
+          else
+            gtk_text_buffer_select_range (buffer, &begin, &end);
+
+          gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (self->view), insert, 0.0, TRUE, 1.0, 0.5);
+
+          if (self->repeat > 0)
+            {
+              self->repeat--;
+              gtk_source_search_context_backward_async (context,
+                                                        &begin,
+                                                        NULL,
+                                                        ide_editor_search_backward_cb,
+                                                        g_object_ref (self));
+              g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REPEAT]);
+            }
         }
     }
 
   ide_editor_search_notify_occurrences_count (self, NULL, context);
 }
 
+static void
+maybe_flip_selection_bounds (IdeEditorSearch *self,
+                             GtkTextBuffer   *buffer,
+                             gboolean         backwards)
+{
+  GtkTextIter begin;
+  GtkTextIter end;
+
+  g_assert (IDE_IS_EDITOR_SEARCH (self));
+  g_assert (GTK_IS_TEXT_BUFFER (buffer));
+
+  /*
+   * The goal of this operation is to try to handle a special case where
+   * we are moving forwards/backwards with an initial selection that matches
+   * the current search-text.
+   *
+   * Instead of potentially unselecting the match, we want to flip the
+   * insert/selection-bound marks so that the selection is extended in
+   * the proper direction.
+   */
+
+  if (gtk_text_buffer_get_selection_bounds (buffer, &begin, &end))
+    {
+      const gchar *search_text = ide_editor_search_get_search_text (self);
+      g_autofree gchar *slice = NULL;
+      guint length;
+
+      if (search_text == NULL)
+        search_text = "";
+
+      gtk_text_iter_order (&begin, &end);
+      length = gtk_text_iter_get_offset (&end) - gtk_text_iter_get_offset (&begin);
+
+      if (!ide_editor_search_get_regex_enabled (self) &&
+          length == strlen (search_text) &&
+          NULL != (slice = gtk_text_iter_get_slice (&begin, &end)) &&
+          strcmp (search_text, slice) == 0)
+        {
+          /* NOTE: This does not work for Regex based search, but that
+           *       is much less likely to be important compared to the
+           *       simple word match check.
+           */
+
+          if (backwards)
+            gtk_text_buffer_select_range (buffer, &begin, &end);
+          else
+            gtk_text_buffer_select_range (buffer, &end, &begin);
+        }
+    }
+}
+
 /**
  * ide_editor_search_move:
  * @self: An #IdeEditorSearch
@@ -1134,8 +1309,8 @@ ide_editor_search_move (IdeEditorSearch          *self,
 {
   GtkSourceSearchContext *context;
   GtkTextBuffer *buffer;
-  GtkTextIter begin;
-  GtkTextIter end;
+  GtkTextMark *insert;
+  GtkTextIter iter;
 
   g_return_if_fail (IDE_IS_EDITOR_SEARCH (self));
   g_return_if_fail (self->view != NULL);
@@ -1145,8 +1320,8 @@ ide_editor_search_move (IdeEditorSearch          *self,
   context = ide_editor_search_acquire_context (self);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->view));
-  gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
-  gtk_text_iter_order (&begin, &end);
+  insert = gtk_text_buffer_get_insert (buffer);
+  gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert);
 
   if (self->reverse)
     {
@@ -1156,43 +1331,48 @@ ide_editor_search_move (IdeEditorSearch          *self,
         direction = IDE_EDITOR_SEARCH_NEXT;
     }
 
+  if (self->repeat > 0)
+    self->repeat--;
+
   switch (direction)
     {
     case IDE_EDITOR_SEARCH_FORWARD:
-      gtk_text_iter_forward_char (&end);
+      gtk_text_iter_forward_char (&iter);
       gtk_source_search_settings_set_wrap_around (self->settings, FALSE);
+      maybe_flip_selection_bounds (self, buffer, FALSE);
       gtk_source_search_context_forward_async (context,
-                                               &end,
+                                               &iter,
                                                NULL,
                                                ide_editor_search_forward_cb,
                                                g_object_ref (self));
       break;
 
     case IDE_EDITOR_SEARCH_NEXT:
-      gtk_text_iter_forward_char (&end);
+      gtk_text_iter_forward_char (&iter);
       gtk_source_search_settings_set_wrap_around (self->settings, TRUE);
       gtk_source_search_context_forward_async (context,
-                                               &end,
+                                               &iter,
                                                NULL,
                                                ide_editor_search_forward_cb,
                                                g_object_ref (self));
       break;
 
     case IDE_EDITOR_SEARCH_BACKWARD:
-      gtk_text_iter_backward_char (&begin);
+      gtk_text_iter_backward_char (&iter);
       gtk_source_search_settings_set_wrap_around (self->settings, FALSE);
+      maybe_flip_selection_bounds (self, buffer, TRUE);
       gtk_source_search_context_backward_async (context,
-                                                &begin,
+                                                &iter,
                                                 NULL,
                                                 ide_editor_search_backward_cb,
                                                 g_object_ref (self));
       break;
 
     case IDE_EDITOR_SEARCH_PREVIOUS:
-      gtk_text_iter_backward_char (&begin);
+      gtk_text_iter_backward_char (&iter);
       gtk_source_search_settings_set_wrap_around (self->settings, TRUE);
       gtk_source_search_context_backward_async (context,
-                                                &begin,
+                                                &iter,
                                                 NULL,
                                                 ide_editor_search_backward_cb,
                                                 g_object_ref (self));
@@ -1203,6 +1383,8 @@ ide_editor_search_move (IdeEditorSearch          *self,
     }
 
   ide_editor_search_release_context (self);
+
+  g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REPEAT]);
 }
 
 /**
@@ -1387,6 +1569,87 @@ ide_editor_search_set_reverse (IdeEditorSearch *self,
     }
 }
 
+/**
+ * ide_editor_search_get_extend_selection:
+ * @self: a #IdeEditorSearch
+ *
+ * Gets the "extend-selection" property.
+ *
+ * This property determines if the selection should be extended and
+ * how when moving between search results.
+ *
+ * Returns: An %IdeEditorSearchSelect
+ *
+ * Since: 3.28
+ */
+IdeEditorSearchSelect
+ide_editor_search_get_extend_selection (IdeEditorSearch *self)
+{
+  g_return_val_if_fail (IDE_IS_EDITOR_SEARCH (self), FALSE);
+
+  return self->extend_selection;
+}
+
+void
+ide_editor_search_set_extend_selection (IdeEditorSearch       *self,
+                                        IdeEditorSearchSelect  extend_selection)
+{
+  g_return_if_fail (IDE_IS_EDITOR_SEARCH (self));
+  g_return_if_fail (extend_selection <= IDE_EDITOR_SEARCH_SELECT_TO_RESULT);
+
+  if (self->extend_selection != extend_selection)
+    {
+      self->extend_selection = extend_selection;
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_EXTEND_SELECTION]);
+    }
+}
+
+/**
+ * ide_editor_search_get_repeat:
+ * @self: a #IdeEditorSearch
+ *
+ * Gets the #IdeEditorSearch: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.
+ *
+ * Returns: A number containing the number of moves.
+ */
+guint
+ide_editor_search_get_repeat (IdeEditorSearch *self)
+{
+  g_return_val_if_fail (IDE_IS_EDITOR_SEARCH (self), 0);
+
+  return self->repeat;
+}
+
+/**
+ * ide_editor_search_set_repeat:
+ * @self: a #IdeEditorSearch
+ * @repeat: The new value for the repeat count
+ *
+ * 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
+ */
+void
+ide_editor_search_set_repeat (IdeEditorSearch *self,
+                              guint            repeat)
+{
+  g_return_if_fail (IDE_IS_EDITOR_SEARCH (self));
+
+  if (self->repeat != repeat)
+    {
+      self->repeat = repeat;
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REPEAT]);
+    }
+}
+
 static void
 ide_editor_search_actions_move_next (IdeEditorSearch *self,
                                      GVariant        *param)
@@ -1414,3 +1677,44 @@ ide_editor_search_actions_replace (IdeEditorSearch *self,
 {
   ide_editor_search_replace (self);
 }
+
+GType
+ide_editor_search_select_get_type (void)
+{
+  static GType type_id;
+
+  if (g_once_init_enter (&type_id))
+    {
+      static const GEnumValue values[] = {
+        { IDE_EDITOR_SEARCH_SELECT_NONE, "IDE_EDITOR_SEARCH_SELECT_NONE", "none" },
+        { IDE_EDITOR_SEARCH_SELECT_WITH_RESULT, "IDE_EDITOR_SEARCH_SELECT_WITH_RESULT", "with-result" },
+        { IDE_EDITOR_SEARCH_SELECT_TO_RESULT, "IDE_EDITOR_SEARCH_SELECT_TO_RESULT", "to-result" },
+        { 0 }
+      };
+      GType _type_id = g_enum_register_static ("IdeEditorSearchSelect", values);
+      g_once_init_leave (&type_id, _type_id);
+    }
+
+  return type_id;
+}
+
+GType
+ide_editor_search_direction_get_type (void)
+{
+  static GType type_id;
+
+  if (g_once_init_enter (&type_id))
+    {
+      static const GEnumValue values[] = {
+        { IDE_EDITOR_SEARCH_FORWARD, "IDE_EDITOR_SEARCH_FORWARD", "forward" },
+        { IDE_EDITOR_SEARCH_NEXT, "IDE_EDITOR_SEARCH_NEXT", "next" },
+        { IDE_EDITOR_SEARCH_PREVIOUS, "IDE_EDITOR_SEARCH_PREVIOUS", "previous" },
+        { IDE_EDITOR_SEARCH_BACKWARD, "IDE_EDITOR_SEARCH_BACKWARD", "backward" },
+        { 0 }
+      };
+      GType _type_id = g_enum_register_static ("IdeEditorSearchDirection", values);
+      g_once_init_leave (&type_id, _type_id);
+    }
+
+  return type_id;
+}
diff --git a/src/libide/editor/ide-editor-search.h b/src/libide/editor/ide-editor-search.h
index 4289307..df280b6 100644
--- a/src/libide/editor/ide-editor-search.h
+++ b/src/libide/editor/ide-editor-search.h
@@ -30,47 +30,75 @@ typedef enum
   IDE_EDITOR_SEARCH_BACKWARD,
 } IdeEditorSearchDirection;
 
-#define IDE_TYPE_EDITOR_SEARCH (ide_editor_search_get_type())
+/**
+ * IdeEditorSearchExtend:
+ * @IDE_EDITOR_SEARCH_SELECT_NONE: do not extend the selection.
+ * @IDE_EDITOR_SEARCH_SELECT_WITH_RESULT: include the result when extending
+ *   the selection.
+ * @IDE_EDITOR_SEARCH_SELECT_TO_RESULT: extend the exelection up to the next
+ *   result but do not include the search result.
+ *
+ * This enum can be used to determine how the selection should be extending
+ * when moving between the search results.
+ */
+typedef enum
+{
+  IDE_EDITOR_SEARCH_SELECT_NONE,
+  IDE_EDITOR_SEARCH_SELECT_WITH_RESULT,
+  IDE_EDITOR_SEARCH_SELECT_TO_RESULT,
+} IdeEditorSearchSelect;
+
+#define IDE_TYPE_EDITOR_SEARCH           (ide_editor_search_get_type())
+#define IDE_TYPE_EDITOR_SEARCH_DIRECTION (ide_editor_search_direction_get_type())
+#define IDE_TYPE_EDITOR_SEARCH_SELECT    (ide_editor_search_select_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);
+GType                  ide_editor_search_direction_get_type           (void);
+GType                  ide_editor_search_select_get_type              (void);
+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);
+IdeEditorSearchSelect  ide_editor_search_get_extend_selection         (IdeEditorSearch           *self);
+void                   ide_editor_search_set_extend_selection         (IdeEditorSearch           *self,
+                                                                       IdeEditorSearchSelect      
extend_selection);
+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);
+guint                  ide_editor_search_get_repeat                   (IdeEditorSearch           *self);
+void                   ide_editor_search_set_repeat                   (IdeEditorSearch           *self,
+                                                                       guint                      repeat);
+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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]