[gnome-builder] editor-frame: scroll the insert mark onscreen upon Escape
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor-frame: scroll the insert mark onscreen upon Escape
- Date: Sat, 9 May 2015 19:10:56 +0000 (UTC)
commit 220290db38427bb9b31621c9df8ee38e9ac47079
Author: Christian Hergert <christian hergert me>
Date: Sat May 9 12:10:11 2015 -0700
editor-frame: scroll the insert mark onscreen upon Escape
Upon Escape being pressed, we would leave the screen where we were, which
could be a very long way from where the insert cursor is.
Simply make sure we scroll to it before focusing.
src/editor/gb-editor-frame.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index e53e140..70ecb67 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -407,6 +407,8 @@ gb_editor_frame__search_key_press_event (GbEditorFrame *self,
GdkEventKey *event,
GdTaggedEntry *entry)
{
+ GtkTextBuffer *buffer;
+
g_assert (GB_IS_EDITOR_FRAME (self));
g_assert (GD_IS_TAGGED_ENTRY (entry));
@@ -416,8 +418,17 @@ gb_editor_frame__search_key_press_event (GbEditorFrame *self,
/* stash the search string for later */
g_free (self->previous_search_string);
g_object_get (self->search_entry, "text", &self->previous_search_string, NULL);
+
+ /* clear the highlights in the source view */
ide_source_view_clear_search (self->source_view);
+
+ /* disable rubberbanding and ensure insert mark is on screen */
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));
ide_source_view_set_rubberband_search (self->source_view, FALSE);
+ ide_source_view_scroll_mark_onscreen (self->source_view,
+ gtk_text_buffer_get_insert (buffer));
+
+ /* finally we can focus the source view */
gtk_widget_grab_focus (GTK_WIDGET (self->source_view));
return GDK_EVENT_STOP;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]