[gnome-builder/wip/chergert/editorsearch] editor: wire-up state changes for movements



commit 38cf65e8125c63f34e0cf0ac809e8e84b88ae34e
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 10 17:54:16 2017 -0700

    editor: wire-up state changes for movements
    
    We want to override any previous value when doing these search
    movements.

 src/libide/editor/ide-editor-search-bar.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-search-bar.c b/src/libide/editor/ide-editor-search-bar.c
index f606966..fee9e7c 100644
--- a/src/libide/editor/ide-editor-search-bar.c
+++ b/src/libide/editor/ide-editor-search-bar.c
@@ -201,7 +201,11 @@ search_entry_previous_match (IdeEditorSearchBar *self,
   g_assert (GTK_IS_SEARCH_ENTRY (entry));
 
   if (self->search != NULL)
-    ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_BACKWARD);
+    {
+      ide_editor_search_set_extend_selection (self->search, IDE_EDITOR_SEARCH_SELECT_NONE);
+      ide_editor_search_set_repeat (self->search, 0);
+      ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_BACKWARD);
+    }
 }
 
 static void
@@ -212,7 +216,11 @@ search_entry_next_match (IdeEditorSearchBar *self,
   g_assert (GTK_IS_SEARCH_ENTRY (entry));
 
   if (self->search != NULL)
-    ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_FORWARD);
+    {
+      ide_editor_search_set_extend_selection (self->search, IDE_EDITOR_SEARCH_SELECT_NONE);
+      ide_editor_search_set_repeat (self->search, 0);
+      ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_FORWARD);
+    }
 }
 
 static void
@@ -223,7 +231,11 @@ search_entry_activate (IdeEditorSearchBar *self,
   g_assert (GD_IS_TAGGED_ENTRY (entry));
 
   if (self->search != NULL)
-    ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_NEXT);
+    {
+      ide_editor_search_set_extend_selection (self->search, IDE_EDITOR_SEARCH_SELECT_NONE);
+      ide_editor_search_set_repeat (self->search, 0);
+      ide_editor_search_move (self->search, IDE_EDITOR_SEARCH_NEXT);
+    }
 
   g_signal_emit (self, signals [STOP_SEARCH], 0);
 }


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