[gnome-builder] try to be more flexible in search entry than in vim mode



commit af97940df68bf0c1566b080cff09c33d6aa3986e
Author: Christian Hergert <christian hergert me>
Date:   Thu Mar 19 21:58:39 2015 -0700

    try to be more flexible in search entry than in vim mode

 libide/ide-source-view.c             |    4 +++-
 src/editor/gb-editor-frame-actions.c |    6 ++++--
 src/editor/gb-editor-frame.c         |   14 ++++++++++++++
 3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 34b68fc..f3beae2 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -3204,7 +3204,9 @@ ide_source_view_real_move_search (IdeSourceView    *self,
   gtk_source_search_context_set_highlight (priv->search_context, TRUE);
 
   settings = gtk_source_search_context_get_settings (priv->search_context);
-  gtk_source_search_settings_set_at_word_boundaries (settings, word_boundaries);
+
+  if (word_boundaries != gtk_source_search_settings_get_at_word_boundaries (settings))
+    gtk_source_search_settings_set_at_word_boundaries (settings, word_boundaries);
 
   search_text = gtk_source_search_settings_get_search_text (settings);
 
diff --git a/src/editor/gb-editor-frame-actions.c b/src/editor/gb-editor-frame-actions.c
index 2e78ace..f6262ac 100644
--- a/src/editor/gb-editor-frame-actions.c
+++ b/src/editor/gb-editor-frame-actions.c
@@ -43,7 +43,8 @@ gb_editor_frame_actions_next_search_result (GSimpleAction *action,
 
   g_assert (GB_IS_EDITOR_FRAME (self));
 
-  g_signal_emit_by_name (self->source_view, "move-search", GTK_DIR_DOWN, FALSE, TRUE, FALSE, FALSE);
+  IDE_SOURCE_VIEW_GET_CLASS (self->source_view)->move_search
+    (self->source_view, GTK_DIR_DOWN, FALSE, TRUE, TRUE, FALSE, FALSE);
 }
 
 static void
@@ -55,7 +56,8 @@ gb_editor_frame_actions_previous_search_result (GSimpleAction *action,
 
   g_assert (GB_IS_EDITOR_FRAME (self));
 
-  g_signal_emit_by_name (self->source_view, "move-search", GTK_DIR_UP, FALSE, TRUE, FALSE, FALSE);
+  IDE_SOURCE_VIEW_GET_CLASS (self->source_view)->move_search
+    (self->source_view, GTK_DIR_UP, FALSE, TRUE, TRUE, FALSE, FALSE);
 }
 
 static const GActionEntry GbEditorFrameActions[] = {
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 9d05d87..53a735c 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -305,6 +305,20 @@ gb_editor_frame__search_key_press_event (GbEditorFrame *self,
         gb_widget_activate_action (GTK_WIDGET (self), "frame", "previous-search-result", NULL);
       return TRUE;
     }
+  else
+    {
+      GtkSourceSearchSettings *search_settings;
+      GtkSourceSearchContext *search_context;
+
+      /*
+       * Other modes, such as Vim emulation, want word boundaries, but we do
+       * not when searching from this entry. Sort of hacky, but gets the job
+       * done to just change that setting here.
+       */
+      search_context = ide_source_view_get_search_context (self->source_view);
+      search_settings = gtk_source_search_context_get_settings (search_context);
+      gtk_source_search_settings_set_at_word_boundaries (search_settings, FALSE);
+    }
 
   return FALSE;
 }


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