diff liboctave/util/cmd-edit.cc @ 16382:389b09a914e2

allow gui to force readline to return from its idle/read loop * cmd-edit.h, cmd-edit.cc (command_editor::interrupt, command_editor::do_interrupt): New functions. (gnu_readline::do_interrupt): New function. * oct-rl-edit.h, oct-rl-edit.c (octave_rl_done): New function. * main-window.cc (main_window::debug_step_into_callback, main_window::debug_step_over_callback, main_window::debug_step_out_callback): Call command_editor::interrupt. * input.cc (get_debug_input): Reset command_editor::interrutp state. If previous state is true, then exit early.
author John W. Eaton <jwe@octave.org>
date Wed, 27 Mar 2013 20:29:06 -0400
parents 049e8bbff782
children 0696dcc92fc8
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.cc	Wed Mar 27 18:37:42 2013 -0400
+++ b/liboctave/util/cmd-edit.cc	Wed Mar 27 20:29:06 2013 -0400
@@ -163,6 +163,8 @@
 
   bool do_filename_quoting_desired (bool);
 
+  void do_interrupt (bool);
+
   static int operate_and_get_next (int, int);
 
   static int history_search_backward (int, int);
@@ -587,6 +589,12 @@
   return ::octave_rl_filename_quoting_desired (arg);
 }
 
+void
+gnu_readline::do_interrupt (bool arg)
+{
+  ::octave_rl_done (arg);
+}
+
 int
 gnu_readline::operate_and_get_next (int /* count */, int /* c */)
 {
@@ -1270,6 +1278,26 @@
     ? instance->do_filename_quoting_desired (arg) : false;
 }
 
+bool
+command_editor::interrupt (bool arg)
+{
+  bool retval;
+
+  if (instance_ok ())
+    {
+      // Return the current interrupt state.
+      retval = instance->interrupted;
+
+      instance->do_interrupt (arg);
+
+      instance->interrupted = arg;
+    }
+  else
+    retval = false;
+
+  return retval;
+}
+
 // Return a string which will be printed as a prompt.  The string may
 // contain special characters which are decoded as follows:
 //