[gnome-builder/wip/libide] libide: track initial cursor position
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide] libide: track initial cursor position
- Date: Wed, 18 Mar 2015 22:21:56 +0000 (UTC)
commit c033f5d1d73f35f69e4538ce3414bc8b5c8c6875
Author: Christian Hergert <christian hergert me>
Date: Wed Mar 18 15:18:07 2015 -0700
libide: track initial cursor position
libide/ide-source-view.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index b18d55e..4bb7362 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -1262,7 +1262,9 @@ static void
ide_source_view__buffer_loaded_cb (IdeSourceView *self,
IdeBuffer *buffer)
{
+ IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
GtkTextMark *insert;
+ GtkTextIter iter;
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (IDE_IS_BUFFER (buffer));
@@ -1278,6 +1280,12 @@ ide_source_view__buffer_loaded_cb (IdeSourceView *self,
*/
insert = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (buffer));
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (self), insert, 0.0, TRUE, 1.0, 0.5);
+
+ /*
+ * Store the line offset so movements are correct.
+ */
+ gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (buffer), &iter, insert);
+ priv->target_line_offset = gtk_text_iter_get_line_offset (&iter);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]