[gnome-builder/wip/libide] libide: always set the insert mark when loading buffer



commit 62c682b796013d3751158b3331e049ee165b5c19
Author: Christian Hergert <christian hergert me>
Date:   Fri Mar 13 02:07:49 2015 -0700

    libide: always set the insert mark when loading buffer

 libide/ide-buffer-manager.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index 8d26eeb..31fb931 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -383,6 +383,7 @@ ide_buffer_manager_load_file__load_cb (GObject      *object,
   IdeBufferManager *self;
   IdeContext *context;
   LoadState *state;
+  GtkTextIter iter;
   GError *error = NULL;
   gsize i;
 
@@ -435,7 +436,6 @@ ide_buffer_manager_load_file__load_cb (GObject      *object,
   if (item != NULL)
     {
       IdeSourceLocation *item_loc;
-      GtkTextIter iter;
       guint line;
       guint line_offset;
 
@@ -449,9 +449,14 @@ ide_buffer_manager_load_file__load_cb (GObject      *object,
       for (; line_offset; line_offset--)
         if (gtk_text_iter_ends_line (&iter) || !gtk_text_iter_forward_char (&iter))
           break;
-
-      gtk_text_buffer_select_range (GTK_TEXT_BUFFER (state->buffer), &iter, &iter);
     }
+  else
+    {
+      IDE_TRACE_MSG ("Restoring insert mark to 0:0");
+      gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (state->buffer), &iter);
+    }
+
+  gtk_text_buffer_select_range (GTK_TEXT_BUFFER (state->buffer), &iter, &iter);
 
 emit_signal:
   g_signal_emit (self, gSignals [BUFFER_LOADED], 0, state->buffer);


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