summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/system/repl/repl.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 86fb56fd2..2f4a3783a 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -107,6 +107,9 @@
(newline)
(set! status '()))
(else
+ ;; since the input port is line-buffered, consume up to the
+ ;; newline
+ (flush-to-newline)
(with-backtrace
(catch 'quit
(lambda ()
@@ -134,3 +137,14 @@
((char-whitespace? ch) (read-char) (next-char wait))
(else ch)))
#f))
+
+(define (flush-to-newline)
+ (if (char-ready?)
+ (let ((ch (peek-char)))
+ (if (and (not (eof-object? ch)) (char-whitespace? ch))
+ (begin
+ (read-char)
+ (if (not (char=? ch #\newline))
+ (flush-to-newline)))))))
+
+ \ No newline at end of file