octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with "yes_or_no" and newline character


From: John W. Eaton
Subject: Problem with "yes_or_no" and newline character
Date: Wed, 4 Apr 2007 14:58:06 -0400

On  4-Apr-2007, Michael Goffioul wrote:

| When executing
| 
|     eval('yes_or_no("Close ? ")')
| 
| the "yes_or_no" never terminates, because the newline character
| is appended to the string returned by interactive_input, which is not
| expected by yes_or_no. When doing the call within "eval", "line_editing"
| is set to false, resulting in "gnu_readline" calling "octave_fgets" instead
| of "command_editor::readline". The problem is that "octave_fgets" includes
| the newline character, while "command_editor::readline" does not.
| 
| Using "octave_fgetl" would probably solve the problem (cannot test for
| the moment).

How about the following patch?

Thanks,

jwe

src/ChangeLog:

2007-04-04  John W. Eaton  <address@hidden>
 
        * input.cc (octave_yes_or_no): Force interactive_input to use readline.

 
 2007-04-03  John W. Eaton  <address@hidden>
Index: src/input.cc
===================================================================
RCS file: /cvs/octave/src/input.cc,v
retrieving revision 1.178
diff -u -u -r1.178 input.cc
--- src/input.cc        1 Mar 2007 15:49:03 -0000       1.178
+++ src/input.cc        4 Apr 2007 18:57:28 -0000
@@ -780,7 +780,7 @@
 
   while (1)
     {
-      std::string input_buf = interactive_input (prompt_string);
+      std::string input_buf = interactive_input (prompt_string, false, true);
 
       if (input_buf == "yes")
        return true;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]