[gnome-builder] ide-source-view: fix move search



commit 8a94adecfb6321e5264ef31ab223c19b9a47e79d
Author: Fangwen Yu <yynyygy gmail com>
Date:   Wed May 4 17:15:03 2016 +0800

    ide-source-view: fix move search
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765955

 data/keybindings/default.css             |    4 ++--
 libide/editor/ide-editor-frame-actions.c |    4 ++--
 libide/ide-source-view.c                 |   13 ++++++++++---
 libide/ide-source-view.h                 |    2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index 668dcf3..1832223 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -47,8 +47,8 @@
   bind "<alt>n" { "move-error" (down) };
   bind "<alt>p" { "move-error" (up) };
 
-  bind "<ctrl>g" { "move-search" (down, 0, 1, 1, 1, 1) };
-  bind "<ctrl><shift>g" { "move-search" (up, 0, 1, 0, 1, 1) };
+  bind "<ctrl>g" { "move-search" (down, 0, 1, 1, 1, -1) };
+  bind "<ctrl><shift>g" { "move-search" (up, 0, 1, 0, 1, -1) };
   bind "<ctrl><shift>k" { "clear-search" () };
 
   bind "<ctrl><alt>i" { "reindent" () };
diff --git a/libide/editor/ide-editor-frame-actions.c b/libide/editor/ide-editor-frame-actions.c
index 6f37084..dac4883 100644
--- a/libide/editor/ide-editor-frame-actions.c
+++ b/libide/editor/ide-editor-frame-actions.c
@@ -87,7 +87,7 @@ ide_editor_frame_actions_next_search_result (GSimpleAction *action,
   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_DOWN, FALSE, TRUE, TRUE, FALSE, FALSE);
+    (self->source_view, GTK_DIR_DOWN, FALSE, TRUE, TRUE, FALSE, -1);
 }
 
 static void
@@ -102,7 +102,7 @@ ide_editor_frame_actions_previous_search_result (GSimpleAction *action,
   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, FALSE);
+    (self->source_view, GTK_DIR_UP, FALSE, TRUE, TRUE, FALSE, -1);
 }
 
 static void
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 457a574..f8c94b2 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -3611,7 +3611,7 @@ ide_source_view_real_move_search (IdeSourceView    *self,
                                   gboolean          select_match,
                                   gboolean          exclusive,
                                   gboolean          apply_count,
-                                  gboolean          word_boundaries)
+                                  gint              word_boundaries)
 {
   IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
   GtkTextView *text_view = (GtkTextView *)self;
@@ -3664,7 +3664,14 @@ ide_source_view_real_move_search (IdeSourceView    *self,
 
   settings = gtk_source_search_context_get_settings (priv->search_context);
 
-  gtk_source_search_settings_set_at_word_boundaries (settings, word_boundaries);
+  /*
+   * A word_boundaries value other than 0 or 1 means that we don't modify
+   * the word_boundaries search setting.
+   */
+  if (word_boundaries == 0)
+    gtk_source_search_settings_set_at_word_boundaries (settings, FALSE);
+  else if (word_boundaries == 1)
+    gtk_source_search_settings_set_at_word_boundaries (settings, TRUE);
 
   search_text = gtk_source_search_settings_get_search_text (settings);
 
@@ -6228,7 +6235,7 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
                   G_TYPE_BOOLEAN,
                   G_TYPE_BOOLEAN,
                   G_TYPE_BOOLEAN,
-                  G_TYPE_BOOLEAN);
+                  G_TYPE_INT);
 
   signals [PASTE_CLIPBOARD_EXTENDED] =
     g_signal_new ("paste-clipboard-extended",
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index 8395c36..d88cb99 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -254,7 +254,7 @@ struct _IdeSourceViewClass
                                        gboolean                 select_match,
                                        gboolean                 exclusive,
                                        gboolean                 apply_count,
-                                       gboolean                 at_word_boundaries);
+                                       gint                     at_word_boundaries);
   void (*paste_clipboard_extended)    (IdeSourceView           *self,
                                        gboolean                 smart_lines,
                                        gboolean                 after_cursor,


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