# HG changeset patch # User Torsten Lilge # Date 1627740465 -7200 # Node ID 116dbaba5a74d79892b8f7d97d0d28a8a0686a7d # Parent 9ec1715a9aae706c29839b9ca846b16c9186c94b fix opening a file in a custom editor (bug #60990) * external-editor-interface.cc (call_custom_editor): call custom editor even for valid line numbers, avoid negative line numbers * file-editor.cc (request_open_file): check preference for custom editor and if set, do nothing in case of debugging diff -r 9ec1715a9aae -r 116dbaba5a74 libgui/src/external-editor-interface.cc --- a/libgui/src/external-editor-interface.cc Sat Jul 31 12:44:04 2021 +0200 +++ b/libgui/src/external-editor-interface.cc Sat Jul 31 16:07:45 2021 +0200 @@ -46,15 +46,13 @@ bool external_editor_interface::call_custom_editor (const QString& file, int line) { - if (line > -1) // check for a specific line (debugging) - return true; // yes: do not open a file in external editor - else - line = 0; // no: start external editor at beginning of file - QString editor = external_editor (); if (editor.isEmpty ()) return true; + if (line < 0) + line = 0; + // replace macros editor.replace ("%f", file); editor.replace ("%l", QString::number (line)); diff -r 9ec1715a9aae -r 116dbaba5a74 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Sat Jul 31 12:44:04 2021 +0200 +++ b/libgui/src/m-editor/file-editor.cc Sat Jul 31 16:07:45 2021 +0200 @@ -1487,11 +1487,19 @@ bool breakpoint_marker, bool insert, const QString& cond, int index) { - if (call_custom_editor (openFileName, line)) - return; // custom editor called - resource_manager& rmgr = m_octave_qobj.get_resource_manager (); gui_settings *settings = rmgr.get_settings (); + + if (settings->value (global_use_custom_editor).toBool ()) + { + // Custom editor + if (debug_pointer || breakpoint_marker) + return; // Do not call custom editor during debugging + + if (call_custom_editor (openFileName, line)) + return; // Custom editor called + } + bool show_dbg_file = settings->value (ed_show_dbg_file).toBool ();