changeset 24566:f5bcbd321ba1

don't trap the user in the readline loop (bug #52757) * cmd-edit.cc (gnu_readline::do_readline): Don't catch command_editor::interrupt_exception. (gnu_readline::do_handle_interrupt_signal): Throw octave::interrupt_exception, not command_editor::interrupt_exception. * cmd-edit.h (class command_editor::interrupt_exception): Delete.
author John W. Eaton <jwe@octave.org>
date Mon, 08 Jan 2018 20:01:13 -0500
parents dbec1e04f499
children 3fa85fe6e495
files liboctave/util/cmd-edit.cc liboctave/util/cmd-edit.h
diffstat 2 files changed, 8 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.cc	Mon Jan 08 16:45:26 2018 -0500
+++ b/liboctave/util/cmd-edit.cc	Mon Jan 08 20:01:13 2018 -0500
@@ -289,31 +289,16 @@
 
     const char *p = prompt.c_str ();
 
-    while (true)
-      {
-        try
-          {
-            char *line = ::octave_rl_readline (p);
-
-            if (line)
-              {
-                retval = line;
+    char *line = ::octave_rl_readline (p);
 
-                free (line);
-              }
-            else
-              eof = true;
+    if (line)
+      {
+        retval = line;
 
-            break;
-          }
-        catch (command_editor::interrupt_exception&)
-          {
-            // Is this right?
-            std::cout << "\n";
-
-            // Try again...
-          }
+        free (line);
       }
+    else
+      eof = true;
 
     return retval;
   }
@@ -803,7 +788,7 @@
 
     ::octave_rl_recover_from_interrupt ();
 
-    throw command_editor::interrupt_exception ();
+    throw octave::interrupt_exception ();
   }
 
   int
--- a/liboctave/util/cmd-edit.h	Mon Jan 08 16:45:26 2018 -0500
+++ b/liboctave/util/cmd-edit.h	Mon Jan 08 20:01:13 2018 -0500
@@ -40,8 +40,6 @@
   {
   protected:
 
-    class interrupt_exception { };
-
     command_editor (void)
       : command_number (0), interrupted (false), initial_input () { }