Fix problem with console echoing in READ-FINISH.
authorChris Hanson <org/chris-hanson/cph>
Fri, 10 Sep 2004 18:01:36 +0000 (18:01 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 10 Sep 2004 18:01:36 +0000 (18:01 +0000)
v7/src/runtime/ttyio.scm

index f0f7961e6e94b3d15ea0a0977d48e110be380de5..2946c9a925f4b9b0c42583e263c3dbe089c62b8c 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: ttyio.scm,v 1.17 2004/02/16 05:39:09 cph Exp $
+$Id: ttyio.scm,v 1.18 2004/09/10 18:01:36 cph Exp $
 
 Copyright 1991,1993,1996,1999,2003,2004 Massachusetts Institute of Technology
 
@@ -105,22 +105,27 @@ USA.
                (fresh-line port)
                (write-string "End of input stream reached" port)))
          (%exit)))
-    (if (and char
-            (cstate-echo-input? (port/state port))
-            (not (nearest-cmdl/batch-mode?)))
-       (output-port/write-char port char))
+    (maybe-echo-input port char)
     char))
 
 (define (operation/read-finish port)
   (let loop ()
     (if (input-port/char-ready? port)
-       (let ((char (input-port/read-char port)))
+       (let ((char (generic-io/read-char port)))
          (if (not (eof-object? char))
              (if (char-whitespace? char)
-                 (loop)
+                 (begin
+                   (maybe-echo-input port char)
+                   (loop))
                  (input-port/unread-char port char))))))
   (output-port/discretionary-flush port))
 
+(define (maybe-echo-input port char)
+  (if (and char
+          (cstate-echo-input? (port/state port))
+          (not (nearest-cmdl/batch-mode?)))
+      (output-port/write-char port char)))
+
 (define (operation/clear port)
   (output-port/write-string port ((ucode-primitive tty-command-clear 0))))