[gnome-builder/wip/chergert/langserv] source-view: stash our position before goto-definition



commit 76d84698730334fb008c20a994fc39d203f04973
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 437e4fe..4cd21f1 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -4940,6 +4940,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.
@@ -7249,9 +7252,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]