[gnome-builder] editor: consistently match in current direction of search
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: consistently match in current direction of search
- Date: Thu, 29 Jan 2015 10:07:16 +0000 (UTC)
commit 9eeec89d7909c6162fd85fa2f8378ae8a1a4ab05
Author: Ray Strode <rstrode redhat com>
Date: Wed Jan 28 13:56:25 2015 -0500
editor: consistently match in current direction of search
There are parts of the code that neglect to consult the
current search direction when deciding which way to match,
and instead just unconditionally match forward.
This commit fixes those places in the code.
https://bugzilla.gnome.org/show_bug.cgi?id=743668
src/editor/gb-editor-frame.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 1866d14..b803d30 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -857,7 +857,14 @@ gb_editor_frame_on_search_entry_changed (GbEditorFrame *self,
search_text = gtk_entry_get_text (entry);
if (!gb_str_empty0 (search_text))
- gb_editor_frame_move_next_match (self, TRUE);
+ {
+ if (self->priv->search_direction == GTK_DIR_DOWN)
+ gb_editor_frame_move_next_match (self, TRUE);
+ else if (self->priv->search_direction == GTK_DIR_UP)
+ gb_editor_frame_move_previous_match (self, TRUE);
+ else
+ g_assert_not_reached ();
+ }
}
static void
@@ -872,7 +879,12 @@ gb_editor_frame_on_search_entry_activate (GbEditorFrame *self,
g_assert (GD_IS_TAGGED_ENTRY (entry));
g_assert (GB_IS_EDITOR_FRAME (self));
- gb_editor_frame_move_next_match (self, TRUE);
+ if (self->priv->search_direction == GTK_DIR_DOWN)
+ gb_editor_frame_move_next_match (self, TRUE);
+ else if (self->priv->search_direction == GTK_DIR_UP)
+ gb_editor_frame_move_previous_match (self, TRUE);
+ else
+ g_assert_not_reached ();
buffer = GTK_TEXT_BUFFER (self->priv->document);
@@ -952,7 +964,12 @@ gb_editor_frame_on_begin_search (GbEditorFrame *self,
const gchar *text;
guint len;
- gb_editor_frame_move_next_match (self, TRUE);
+ if (direction == GTK_DIR_DOWN)
+ gb_editor_frame_move_next_match (self, TRUE);
+ else if (direction == GTK_DIR_UP)
+ gb_editor_frame_move_previous_match (self, TRUE);
+ else
+ g_assert_not_reached ();
/*
* We manually get the string length instead of passing -1 for length
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]