diff libgui/src/main-window.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 ac9db42ef23e
children 3cacd597464d
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Wed Mar 27 18:37:42 2013 -0400
+++ b/libgui/src/main-window.cc	Wed Mar 27 20:29:06 2013 -0400
@@ -50,6 +50,7 @@
 #include "toplev.h"
 #include "version.h"
 
+#include "cmd-edit.h"
 #include "cmd-hist.h"
 #include "oct-env.h"
 
@@ -1215,22 +1216,35 @@
   Fdbcont ();
 }
 
+// The next three callbacks are invoked by GUI buttons.  Those buttons
+// should only be active when we are doing debugging, which means that
+// Octave is waiting for input in get_debug_input.  Calling
+// command_editor::interrupt will force readline to return even if it
+// has not read any input, and then get_debug_input will return,
+// allowing the evaluator to continue and execute the next statement.
+
 void
 main_window::debug_step_into_callback (void)
 {
   Fdbstep (ovl ("in"));
+
+  command_editor::interrupt (true);
 }
 
 void
 main_window::debug_step_over_callback (void)
 {
   Fdbstep ();
+
+  command_editor::interrupt (true);
 }
 
 void
 main_window::debug_step_out_callback (void)
 {
   Fdbstep (ovl ("out"));
+
+  command_editor::interrupt (true);
 }
 
 void