changeset 30878:a1c2ea6deaa4

fix err messages when running selected code while in dbg mode (bug #62105) * octave-qscintilla.cc (contextmenu_run): when in debug mode, remove line and column number from error message also for stack size two and drop another stack level from the error message
author Torsten Lilge <ttl-octave@mailbox.org>
date Fri, 01 Apr 2022 23:02:18 +0200
parents 2bb539746697
children af6623656f53
files libgui/src/m-editor/octave-qscintilla.cc
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc	Thu Mar 31 13:30:03 2022 +0200
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Fri Apr 01 23:02:18 2022 +0200
@@ -948,8 +948,11 @@
 
              // Remove line and column from first line of error message only
              // if it is related to the tmp itself, i.e. only if the
-             // the error stack size is 0 or 1
-             if (stack.size () < 2)
+             // the error stack size is 0, 1, or, if in debug mode, 2
+             size_t max_stack_size = 1;
+             if (dbg)
+               max_stack_size = 2;
+             if (stack.size () <= max_stack_size)
                {
                  QRegExp rx ("source: error sourcing file [^\n]*$");
                  if (new_msg.contains (rx))
@@ -984,9 +987,12 @@
                    }
                }
 
-             // Drop first stack level, i.e. temporary function file
+             // Drop first stack level, which is the temporary function file,
+             // or, if in debug mode, drop first two stack levels
              if (stack.size () > 0)
                stack.pop_back ();
+             if (dbg && (stack.size () > 0))
+               stack.pop_back ();
 
              // Clean up before throwing the modified error.
              emit ctx_menu_run_finished_signal (show_dbg_file, err_line,