changeset 11980:bfa0fc8559b5 release-3-2-x

avoid using readline at all when line editing suppressed or interpreter embedded
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 11 Jun 2009 07:13:19 +0200
parents ba624b9b7679
children f69e27ff396a
files liboctave/ChangeLog liboctave/cmd-edit.cc liboctave/cmd-edit.h src/ChangeLog src/octave.cc
diffstat 5 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-09  Jaroslav Hajek  <highegg@gmail.com>
+
+	* cmd-edit.cc (command_editor::force_default_editor): New static
+	method.
+	* cmd-edit.h: Declare it.
+
 2009-06-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* lo-mappers.cc (xlog2 (const Complex&, int&), xlog2 (const
--- a/liboctave/cmd-edit.cc
+++ b/liboctave/cmd-edit.cc
@@ -837,6 +837,13 @@
 #endif
 }
 
+void 
+command_editor::force_default_editor (void)
+{
+  delete instance;
+  instance = new default_command_editor ();
+}
+
 int
 command_editor::startup_handler (void)
 {
--- a/liboctave/cmd-edit.h
+++ b/liboctave/cmd-edit.h
@@ -150,6 +150,8 @@
 
   static void increment_current_command_number (void);
 
+  static void force_default_editor (void);
+
 private:
 
   // No copying!
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,7 @@
 
 	* octave.cc (octave_main): Call initialize_command_input
 	conditionally. Move line_editing update in front of it.
+	Call command_editor::force_default_editor if not line_editing.
 
 2009-06-09  Jaroslav Hajek  <highegg@gmail.com>
 
--- a/src/octave.cc
+++ b/src/octave.cc
@@ -786,6 +786,10 @@
   if (! interactive && ! forced_line_editing)
     line_editing = false;
 
+  // Force default line editor if we don't want readline editing.
+  if (! line_editing)
+    command_editor::force_default_editor ();
+
   // These can come after command line args since none of them set any
   // defaults that might be changed by command line options.