Mercurial > octave
diff libgui/src/m-editor/file-editor.cc @ 25622:a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
* gui-preferences.h: new const struct for this preference
* file-editor.cc: include gui-preferences.h;
(request_open_file): give editor tab of related file the focus only if it
is desired to open editor files, do not open a closed file when inserting
a breakpoint or update the debug pointer, never open a closed file when
removing a breakpoint;
* settings-dialog.cc (settings_dialog): initialize the new checkbox from the
preferences file;
(write_changed_settings): store checkbox state into the preferences file;
* settings-dialog.ui: add new debugging section in editor tab with checkbox
for opening files when debugging from console window
author | Torsten <mttl@mailbox.org> |
---|---|
date | Sun, 15 Jul 2018 11:56:04 +0200 |
parents | 3edae6ba1fcd |
children | 331f46b9ee6c |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc Sat Jul 14 22:48:02 2018 -0700 +++ b/libgui/src/m-editor/file-editor.cc Sun Jul 15 11:56:04 2018 +0200 @@ -45,6 +45,7 @@ #include <Qsci/qscicommandset.h> #include "main-window.h" +#include "gui-preferences.h" #include "oct-map.h" #include "octave-link.h" #include "utils.h" @@ -1190,6 +1191,10 @@ if (call_custom_editor (openFileName, line)) return; // custom editor called + QSettings *settings = resource_manager::get_settings (); + bool show_dbg_file + = settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool (); + if (openFileName.isEmpty ()) { // This happens if edit is calles without an argument @@ -1217,7 +1222,7 @@ emit fetab_do_breakpoint_marker (insert, tab, line, cond); } - if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) + if (show_dbg_file && ! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) { emit fetab_set_focus (tab); focus (); @@ -1225,6 +1230,12 @@ } else { + if (! show_dbg_file && (breakpoint_marker || debug_pointer)) + return; // Do not open a file for showing dbg markers + + if (breakpoint_marker && ! insert) + return; // Never open a file when removing breakpoints + file_editor_tab *fileEditorTab = nullptr; // Reuse <unnamed> tab if it hasn't yet been modified. bool reusing = false;