the problem is that parser/parse-next waits for an enter before returning an object we can use peek-char to pre-emptively react to any EOF at the start of the line in case of not-start-of-line, parse-next takes over Co-authored-by: Alice Margatroid <code@alice.bunkerlabs.net>
This commit is contained in:
parent
dc2502ebae
commit
965c177bca
1 changed files with 8 additions and 7 deletions
|
|
@ -63,13 +63,14 @@
|
||||||
(eval-form sci-ctx `(apply require (quote ~m/repl-requires)))))
|
(eval-form sci-ctx `(apply require (quote ~m/repl-requires)))))
|
||||||
:read (or read
|
:read (or read
|
||||||
(fn [_request-prompt request-exit]
|
(fn [_request-prompt request-exit]
|
||||||
(let [v (parser/parse-next sci-ctx in)]
|
(if (nil? (r/peek-char in))
|
||||||
(skip-if-eol in)
|
request-exit
|
||||||
(if (or (identical? :repl/quit v)
|
(let [v (parser/parse-next sci-ctx in)]
|
||||||
(identical? :repl/exit v)
|
(skip-if-eol in)
|
||||||
(identical? parser/eof v))
|
(if (or (identical? :repl/quit v)
|
||||||
request-exit
|
(identical? :repl/exit v))
|
||||||
v))))
|
request-exit
|
||||||
|
v)))))
|
||||||
:eval (or eval
|
:eval (or eval
|
||||||
(fn [expr]
|
(fn [expr]
|
||||||
(sci/with-bindings {sci/file "<repl>"
|
(sci/with-bindings {sci/file "<repl>"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue