[gnome-builder] source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search
- Date: Mon, 12 Oct 2015 14:59:18 +0000 (UTC)
commit cb0f6ac8b8910eadacc6602df638fd7a0ef7a189
Author: Ray Strode <rstrode redhat com>
Date: Sun Oct 11 14:11:02 2015 -0400
source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search
Now that we have a search-direction property we should treat
TAB_FORWARD and TAB_BACKWARD as meaning search relative to
the current search direction.
This commit allows TAB_FORWARD / TAB_BACKWARD in move_search
and translates them to an absolute search direction.
https://bugzilla.gnome.org/show_bug.cgi?id=756405
libide/ide-source-view.c | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 7bad80a..da7f940 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -3297,13 +3297,40 @@ ide_source_view_real_move_search (IdeSourceView *self,
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
g_return_if_fail (IDE_IS_SOURCE_VIEW (self));
- g_return_if_fail ((dir == GTK_DIR_LEFT) || (dir == GTK_DIR_RIGHT) ||
- (dir == GTK_DIR_UP) || (dir == GTK_DIR_DOWN));
if (!priv->search_context)
return;
- priv->search_direction = dir;
+ if (dir == GTK_DIR_TAB_BACKWARD)
+ {
+ switch (priv->search_direction)
+ {
+ case GTK_DIR_LEFT:
+ dir = GTK_DIR_RIGHT;
+ break;
+ case GTK_DIR_RIGHT:
+ dir = GTK_DIR_LEFT;
+ break;
+ case GTK_DIR_UP:
+ dir = GTK_DIR_DOWN;
+ break;
+ case GTK_DIR_DOWN:
+ dir = GTK_DIR_UP;
+ break;
+ case GTK_DIR_TAB_FORWARD:
+ case GTK_DIR_TAB_BACKWARD:
+ default:
+ g_return_if_reached ();
+ }
+ }
+ else if (dir == GTK_DIR_TAB_FORWARD)
+ {
+ dir = priv->search_direction;
+ }
+ else
+ {
+ priv->search_direction = dir;
+ }
gtk_source_search_context_set_highlight (priv->search_context, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]