[gnome-builder/wip/commands] editor: ensure cursor is at the top



commit dbf149d84790e386ea8f26a69aef42440e483e56
Author: Christian Hergert <christian hergert me>
Date:   Tue Oct 7 14:40:12 2014 -0700

    editor: ensure cursor is at the top

 src/editor/gb-editor-commands.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/editor/gb-editor-commands.c b/src/editor/gb-editor-commands.c
index 2370e32..e07163f 100644
--- a/src/editor/gb-editor-commands.c
+++ b/src/editor/gb-editor-commands.c
@@ -360,6 +360,7 @@ on_load_cb (GtkSourceFileLoader *loader,
             GAsyncResult        *result,
             GbEditorTab         *tab)
 {
+  GtkTextBuffer *buffer;
   GtkTextIter begin;
   GtkTextIter end;
   GError *error = NULL;
@@ -382,10 +383,12 @@ on_load_cb (GtkSourceFileLoader *loader,
       g_clear_error (&error);
     }
 
-  gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (tab->priv->document),
-                              &begin, &end);
-  gtk_text_buffer_select_range (GTK_TEXT_BUFFER (tab->priv->document),
-                                &begin, &begin);
+  buffer = GTK_TEXT_BUFFER (tab->priv->document);
+  gtk_text_buffer_get_bounds (buffer, &begin, &end);
+  gtk_text_buffer_select_range (buffer, &begin, &begin);
+  gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (tab->priv->source_view),
+                                gtk_text_buffer_get_insert (buffer),
+                                0.0, TRUE, 0.0, 0.0);
 
   gtk_source_gutter_renderer_set_visible (tab->priv->change_renderer, TRUE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]