diff liboctave/util/cmd-edit.h @ 27339:64289bf338da

use separate variable for interrupting command editor event loop (bug #56738) * cmd-edit.h, cmd-edit.cc (command_editor::interrupt_event_loop): New static function. (command_editor::event_loop_interrupted): Rename from input_interrupted. Change all uses. (command_editor::do_event_loop_interrupted): Rename from do_input_interrupted. Change all uses. (command_editor::do_interrupt_event_loop): New function. (command_editor::m_interrupt_event_loop): New member variable. (gnu_readline::do_input_interrupted): Delete * main-window.cc (main_window::execute_command_in_terminal, main_window::run_file_in_terminal): Call command_editor::interrupt_event_loop in callback function. * action-container.cc (action_container::run): Reset command_editor interrupt_event_loop state before breaking out of loop. * oct-rl-edit.h, oct-rl-edit.c (octave_rl_input_interrupted): Delete. - static bool input_interrupted (void); + static void interrupt_event_loop (bool flag = true); + + static bool event_loop_interrupted (void); static int current_command_number (void); @@ -360,9 +362,14 @@ namespace octave virtual void do_interrupt (bool) { } - virtual bool do_input_interrupted (void) { return false; } + virtual void do_handle_interrupt_signal (void) { } + + void do_interrupt_event_loop (bool arg) { m_interrupt_event_loop = arg; } - virtual void do_handle_interrupt_signal (void) { } + bool do_event_loop_interrupted (void) const + { + return m_interrupt_event_loop; + } int do_insert_initial_input (void); @@ -380,6 +387,8 @@ namespace octave bool interrupted; + bool m_interrupt_event_loop; + std::string initial_input; }; }
author John W. Eaton <jwe@octave.org>
date Wed, 14 Aug 2019 00:19:34 -0400
parents 829d9efb7730
children 3db033e86376
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.h	Tue Aug 13 19:13:46 2019 -0400
+++ b/liboctave/util/cmd-edit.h	Wed Aug 14 00:19:34 2019 -0400
@@ -42,7 +42,7 @@
 
     command_editor (void)
       : command_number (0), m_rows (24), m_cols (80), interrupted (false),
-        initial_input ()
+        m_interrupt_event_loop (false), initial_input ()
       { }
 
   public:
@@ -187,7 +187,9 @@
 
     static bool interrupt (bool = true);
 
-    static bool input_interrupted (void);
+    static void interrupt_event_loop (bool flag = true);
+
+    static bool event_loop_interrupted (void);
 
     static int current_command_number (void);
 
@@ -360,9 +362,14 @@
 
     virtual void do_interrupt (bool) { }
 
-    virtual bool do_input_interrupted (void) { return false; }
+    virtual void do_handle_interrupt_signal (void) { }
+
+    void do_interrupt_event_loop (bool arg) { m_interrupt_event_loop = arg; }
 
-    virtual void do_handle_interrupt_signal (void) { }
+    bool do_event_loop_interrupted (void) const
+    {
+      return m_interrupt_event_loop;
+    }
 
     int do_insert_initial_input (void);
 
@@ -380,6 +387,8 @@
 
     bool interrupted;
 
+    bool m_interrupt_event_loop;
+
     std::string initial_input;
   };
 }