changeset 29912:da5cc930ff10

Change startup so that '--interactive' does not always force '--no-line-editing' (bug #60696). * interpreter.cc (interpreter::interpreter): Create temporary variable "forced_interactive" that holds state from the const-declared variable "options". Check if forced interactive option was given in conjunction with a session that is already interactive ("m_interactive"). If found, then reset the forced nature of session to false both in the application ("app_context") and locally in the temporary variable "forced_interactive".
author Rik <rik@octave.org>
date Thu, 22 Jul 2021 11:39:14 -0700
parents 218716316e62
children 3eca54836f97
files libinterp/corefcn/interpreter.cc
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Thu Jul 22 13:53:43 2021 -0400
+++ b/libinterp/corefcn/interpreter.cc	Thu Jul 22 11:39:14 2021 -0700
@@ -567,12 +567,20 @@
         m_interactive = (! is_octave_program && stdin_is_tty
                          && octave_isatty_wrapper (fileno (stdout)));
 
+        // Don't force interactive if we're already interactive (bug #60696).
+        bool forced_interactive = options.forced_interactive ();
+        if (m_interactive)
+          {
+            m_app_context->forced_interactive (false);
+            forced_interactive = false;
+          }
+
         // Check if the user forced an interactive session.
-        if (options.forced_interactive ())
+        if (forced_interactive)
           m_interactive = true;
 
         line_editing = options.line_editing ();
-        if ((! m_interactive || options.forced_interactive ())
+        if ((! m_interactive || forced_interactive)
             && ! options.forced_line_editing ())
           line_editing = false;