handle multiline text output properly

This commit is contained in:
Jakub 2026-07-12 16:29:41 +08:00
parent db65e7c5e2
commit a247c89332

View file

@ -47,7 +47,10 @@ that the DOM and running scripts can be modified.
PROMPT specifies the user prompt."
(let* ((add-line (lambda (state text prompt?)
(set! state.lines (cons `&(:text ,text :prompt ,prompt?) state.lines))))
(map
(lambda (l)
(set! state.lines (cons `&(:text ,l :prompt ,prompt?) state.lines)))
(string-split "\n" text))))
(evaluate (lambda (state cmd)
(add-line state (format "~a~a" prompt cmd) #t)
(let ((res (eval (with-input-from-string cmd read))))