[gnome-builder] source-view: stash our position before goto-definition



commit 0a289eb437c027880737684b8335fd0e2e7c246e
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 24 21:25:21 2016 -0700

    source-view: stash our position before goto-definition

 libide/sourceview/ide-source-view.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 5a4ea0b..d20043f 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -4947,6 +4947,9 @@ ide_source_view_goto_definition_symbol_cb (GObject      *object,
                      filename, line+1, line_offset+1);
 #endif
 
+      /* Stash our current position for jump-back */
+      ide_source_view_jump (self, NULL);
+
       /*
        * If we are navigating within this file, just stay captive instead of
        * potentially allowing jumping to the file in another editor.
@@ -7256,9 +7259,18 @@ ide_source_view_jump (IdeSourceView     *self,
                       const GtkTextIter *location)
 {
   IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+  GtkTextIter iter;
 
   g_return_if_fail (IDE_IS_SOURCE_VIEW (self));
-  g_return_if_fail (location);
+
+  if (location == NULL)
+    {
+      GtkTextMark *mark;
+
+      mark = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (priv->buffer));
+      gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (priv->buffer), &iter, mark);
+      location = &iter;
+    }
 
   if (priv->buffer && !_ide_buffer_get_loading (priv->buffer))
     g_signal_emit (self, signals [JUMP], 0, location);


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