changeset 24123:16c8ec7f0867

do not move the cursor when saving a file with breakpoints (bug #51793) * file-editor-tab.h: new counter for the number of breakpoints that have to be restored during file saving; * file-editor-tab.cc (file_editor_tab): initialize new counter for breakpoints that have to be restored to zero; (goto_line): if breakpoints are restored, just decrement counter and return; (check_restore_breakpoints): set the counter of breakpoints to restore * file-editor.cc (request_open_file): request going to the breakpoint line only if the breakpoint is inserted, not if it is removed
author Torsten <mttl@mailbox.org>
date Thu, 05 Oct 2017 07:32:34 +0200
parents 813b1385f85d
children 9182a640afbe
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Mon Oct 02 17:38:30 2017 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Thu Oct 05 07:32:34 2017 +0200
@@ -107,6 +107,7 @@
 
   _bp_lines.clear ();      // start with empty lists of breakpoints
   _bp_conditions.clear ();
+  m_bp_restore_count = 0;
 
   // disable editor drag & drop so parent can handle
   _edit_area->setAcceptDrops (false);
@@ -1330,6 +1331,14 @@
   if (ID != this)
     return;
 
+  if (m_bp_restore_count > 0)
+    {
+      // This goto-line request is invoked by restoring a breakpoint during
+      // saving the file, thus, do not go to the related line
+      m_bp_restore_count--;
+      return;
+    }
+
   if (line <= 0)  // ask for desired line
     {
       bool ok = false;
@@ -1625,6 +1634,7 @@
       remove_all_breakpoints (this);
 
       // and set breakpoints at the new linenumbers
+      m_bp_restore_count = _bp_lines.length ();
       for (int i = 0; i < _bp_lines.length (); i++)
         handle_request_add_breakpoint (_bp_lines.value (i) + 1,
                                        _bp_conditions.value (i));
--- a/libgui/src/m-editor/file-editor-tab.h	Mon Oct 02 17:38:30 2017 -0700
+++ b/libgui/src/m-editor/file-editor-tab.h	Thu Oct 05 07:32:34 2017 +0200
@@ -307,6 +307,7 @@
   bool _lines_changed;
   bool _highlight_all_occurrences;
   int _indicator_highlight_all;
+  int m_bp_restore_count;
 
 };
 
--- a/libgui/src/m-editor/file-editor.cc	Mon Oct 02 17:38:30 2017 -0700
+++ b/libgui/src/m-editor/file-editor.cc	Thu Oct 05 07:32:34 2017 +0200
@@ -1347,7 +1347,8 @@
 
           if (line > 0)
             {
-              emit fetab_goto_line (tab, line);
+              if (insert)
+                emit fetab_goto_line (tab, line);
 
               if (debug_pointer)
                 emit fetab_insert_debugger_pointer (tab, line);
@@ -1399,7 +1400,8 @@
 
                   if (line > 0)
                     {
-                      emit fetab_goto_line (fileEditorTab, line);
+                      if (insert)
+                        emit fetab_goto_line (fileEditorTab, line);
 
                       if (debug_pointer)
                         emit fetab_insert_debugger_pointer (fileEditorTab,