[gnome-builder] GbEditorFrame: clear selection after entry activation.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] GbEditorFrame: clear selection after entry activation.
- Date: Sun, 28 Dec 2014 11:37:38 +0000 (UTC)
commit 7c7d2cd9d94c3f1a18a07a1e1f355df3ded3e79f
Author: Christian Hergert <christian hergert me>
Date: Sun Dec 28 03:34:48 2014 -0800
GbEditorFrame: clear selection after entry activation.
This allows us to move to the next result and then clear the selection,
which feels more natural to keep typing.
src/editor/gb-editor-frame.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 9d143f3..9153a3c 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -739,12 +739,28 @@ static void
gb_editor_frame_on_search_entry_activate (GbEditorFrame *self,
GdTaggedEntry *entry)
{
+ GtkTextBuffer *buffer;
+ GtkTextIter begin;
+ GtkTextIter end;
ENTRY;
g_assert (GD_IS_TAGGED_ENTRY (entry));
g_assert (GB_IS_EDITOR_FRAME (self));
gb_editor_frame_move_next_match (self);
+
+ buffer = GTK_TEXT_BUFFER (self->priv->document);
+
+ if (gtk_text_buffer_get_has_selection (buffer))
+ {
+ gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
+
+ if (gtk_text_iter_compare (&begin, &end) <= 0)
+ gtk_text_buffer_select_range (buffer, &begin, &begin);
+ else
+ gtk_text_buffer_select_range (buffer, &end, &end);
+ }
+
gtk_widget_grab_focus (GTK_WIDGET (self->priv->source_view));
EXIT;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]