changeset 19840:c5f0df2a7291

fix error when entering dbcont in terminal while running a file from gui * octave-cmd.cc (prepare_command_editor): removed obsolete function; (octave_cmd_exec::execute): part of prepare_command_editor moved here; (octave_cmd_eval::execute): part of prepare_command_editor moved here in changed order * octave-cmd.h: removed obsolete function prepare_command_editor
author Torsten <ttl@justmail.de>
date Sat, 21 Feb 2015 16:04:00 +0100
parents 0093b9987ee0
children 5512baa94d30
files libgui/src/octave-cmd.cc libgui/src/octave-cmd.h
diffstat 2 files changed, 11 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-cmd.cc	Sat Feb 21 06:15:50 2015 -0800
+++ b/libgui/src/octave-cmd.cc	Sat Feb 21 16:04:00 2015 +0100
@@ -34,26 +34,17 @@
 #include "utils.h"
 
 
-void
-octave_cmd::prepare_command_editor (const QString& cmd)
-{
-  std::string pending_input = command_editor::get_current_line ();
-
-  command_editor::set_initial_input (pending_input);
-  command_editor::replace_line (cmd.toStdString ());
-  command_editor::redisplay ();
-  // We are executing inside the command editor event loop.  Force
-  // the current line to be returned for processing.
-}
-
-
 // ---------------------------------------------------------------------
 //  class octave_cmd_exec: executing a command
 
 void
 octave_cmd_exec::execute ()
 {
-  prepare_command_editor (_cmd);
+  std::string pending_input = command_editor::get_current_line ();
+
+  command_editor::set_initial_input (pending_input);
+  command_editor::replace_line (_cmd.toStdString ());
+  command_editor::redisplay ();
   command_editor::accept_line ();
 }
 
@@ -68,7 +59,7 @@
   function_name.chop (_info.suffix ().length () + 1);
   std::string file_path = _info.absoluteFilePath ().toStdString ();
 
-  prepare_command_editor ("");
+  std::string pending_input = command_editor::get_current_line ();
 
   if (valid_identifier (function_name.toStdString ()))
     { // valid identifier: call as function with possibility to debug
@@ -81,5 +72,9 @@
       Fsource (ovl (file_path));
     }
 
-  command_editor::accept_line ();
+  command_editor::replace_line ("");
+  command_editor::set_initial_input (pending_input);
+  command_editor::redisplay ();
+
+  command_editor::interrupt ();
 }
--- a/libgui/src/octave-cmd.h	Sat Feb 21 06:15:50 2015 -0800
+++ b/libgui/src/octave-cmd.h	Sat Feb 21 16:04:00 2015 +0100
@@ -36,7 +36,6 @@
   virtual ~octave_cmd () { };
 
   virtual void execute () { };
-  void prepare_command_editor (const QString& cmd);
 };