[gnome-builder] editor: reduce chances of jumping from cursor restore position



commit f7b216277fbf7ce1ab0a8ae4b6e2723111baff82
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 14 15:46:52 2018 -0700

    editor: reduce chances of jumping from cursor restore position

 src/libide/editor/ide-editor-perspective.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/editor/ide-editor-perspective.c b/src/libide/editor/ide-editor-perspective.c
index db2a43a57..c55ef30a3 100644
--- a/src/libide/editor/ide-editor-perspective.c
+++ b/src/libide/editor/ide-editor-perspective.c
@@ -527,7 +527,14 @@ ide_editor_perspective_focus_location_full (IdeEditorPerspective *self,
 
   stack = gtk_widget_get_ancestor (GTK_WIDGET (lookup.view), IDE_TYPE_LAYOUT_STACK);
   ide_layout_stack_set_visible_child (IDE_LAYOUT_STACK (stack), IDE_LAYOUT_VIEW (lookup.view));
-  ide_editor_view_scroll_to_line_offset (lookup.view, line, line_offset);
+
+  /*
+   * Ignore 0:0 so that we don't jump from the previous cursor position,
+   * if any. It's somewhat problematic if we know we need to go to 0:0,
+   * but that is less likely.
+   */
+  if (line || line_offset)
+    ide_editor_view_scroll_to_line_offset (lookup.view, line, line_offset);
 
   IDE_EXIT;
 }


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