[gtksourceview/wip/chergert/snippets] scroll to insertion points
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/snippets] scroll to insertion points
- Date: Wed, 29 Jan 2020 04:13:44 +0000 (UTC)
commit ff20f2d103a89c67e6ade4db24956fa7f735cdc5
Author: Christian Hergert <chergert redhat com>
Date: Tue Jan 28 20:13:13 2020 -0800
scroll to insertion points
gtksourceview/gtksourceview-snippets.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/gtksourceview/gtksourceview-snippets.c b/gtksourceview/gtksourceview-snippets.c
index e01f77aa..899eba61 100644
--- a/gtksourceview/gtksourceview-snippets.c
+++ b/gtksourceview/gtksourceview-snippets.c
@@ -63,6 +63,15 @@ gtk_source_view_snippets_unblock (GtkSourceViewSnippets *snippets)
snippets->buffer_cursor_moved_handler);
}
+static void
+gtk_source_view_snippets_scroll_to_insert (GtkSourceViewSnippets *snippets)
+{
+ g_assert (snippets != NULL);
+
+ gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (snippets->view),
+ gtk_text_buffer_get_insert (snippets->buffer));
+}
+
static void
buffer_insert_text_cb (GtkTextBuffer *buffer,
GtkTextIter *location,
@@ -427,6 +436,8 @@ _gtk_source_view_snippets_key_pressed (GtkSourceViewSnippets *snippets,
_gtk_source_view_snippets_pop (snippets);
}
+ gtk_source_view_snippets_scroll_to_insert (snippets);
+
return GDK_EVENT_STOP;
}
else if (state & GDK_SHIFT_MASK)
@@ -436,6 +447,8 @@ _gtk_source_view_snippets_key_pressed (GtkSourceViewSnippets *snippets,
_gtk_source_view_snippets_pop (snippets);
}
+ gtk_source_view_snippets_scroll_to_insert (snippets);
+
return GDK_EVENT_STOP;
}
}
@@ -450,6 +463,7 @@ _gtk_source_view_snippets_key_pressed (GtkSourceViewSnippets *snippets,
!has_selection &&
gtk_source_view_snippets_try_expand (snippets, &end))
{
+ gtk_source_view_snippets_scroll_to_insert (snippets);
return GDK_EVENT_STOP;
}
}
@@ -522,6 +536,8 @@ _gtk_source_view_snippets_pop (GtkSourceViewSnippets *snippets)
g_free (new_text);
}
+ gtk_source_view_snippets_scroll_to_insert (snippets);
+
g_object_unref (snippet);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]