Mercurial > octave
changeset 33532:5157dd5a6c9a
exp. term. widget: allow running files from editor and file browser
* main-window.cc (run_file_in_terminal): if using experimental terminal
widget, emit the related signal for executing a command in the widget
instead of using the command-editor
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sun, 05 May 2024 11:30:05 +0200 |
parents | a22f385de6ba |
children | e89b2f30867d 9bfc3c313ec4 |
files | libgui/src/main-window.cc |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Sat May 04 17:56:39 2024 +0200 +++ b/libgui/src/main-window.cc Sun May 05 11:30:05 2024 +0200 @@ -1194,7 +1194,7 @@ main_window::run_file_in_terminal (const QFileInfo& info, int opts) { emit interpreter_event - ([info, opts] (interpreter& interp) + ([this, opts, info] (interpreter& interp) { // INTERPRETER THREAD @@ -1228,7 +1228,11 @@ else if (opts == ED_RUN_DEMOS) cmd = "demo "; cmd = cmd + function_name; - command_editor::replace_line (cmd.toStdString ()); + + if (m_octave_qobj.experimental_terminal_widget ()) + emit execute_command_signal (cmd); + else + command_editor::replace_line (cmd.toStdString ()); } } else @@ -1243,10 +1247,13 @@ } } - command_editor::set_initial_input (pending_input); - command_editor::redisplay (); - command_editor::interrupt_event_loop (); - command_editor::accept_line (); + if (! m_octave_qobj.experimental_terminal_widget ()) + { + command_editor::set_initial_input (pending_input); + command_editor::redisplay (); + command_editor::interrupt_event_loop (); + command_editor::accept_line (); + } }); focus_console_after_command ();