diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index f0a8f745..a1b6dae8 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -7,7 +7,7 @@ racket/file racket/sandbox racket/promise - mzlib/string + racket/string (for-syntax racket/base)) (provide interaction @@ -97,18 +97,24 @@ (map (lambda (s) (car (format-output s error-color))) - (let sloop ([s (caar val-list+outputs)]) - (if ((string-length s) . > . maxlen) - ;; break the error message into multiple lines: - (let loop ([pos (sub1 maxlen)]) - (cond - [(zero? pos) (cons (substring s 0 maxlen) - (sloop (substring s maxlen)))] - [(char-whitespace? (string-ref s pos)) - (cons (substring s 0 pos) - (sloop (substring s (add1 pos))))] - [else (loop (sub1 pos))])) - (list s)))) + (filter + (lambda (s) (not (equal? s ""))) + (let sloop ([s (caar val-list+outputs)]) + (apply + append + (map (lambda (s) + (if ((string-length s) . > . maxlen) + ;; break the error message into multiple lines: + (let loop ([pos (sub1 maxlen)]) + (cond + [(zero? pos) (cons (substring s 0 maxlen) + (sloop (substring s maxlen)))] + [(char-whitespace? (string-ref s pos)) + (cons (substring s 0 pos) + (sloop (substring s (add1 pos))))] + [else (loop (sub1 pos))])) + (list s))) + (regexp-split #rx"\n" s)))))) ;; Normal result case: (let ([val-list (caar val-list+outputs)]) (if (equal? val-list (list (void))) diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl index ab93e2af..88504396 100644 --- a/collects/scribblings/scribble/eval.scrbl +++ b/collects/scribblings/scribble/eval.scrbl @@ -28,9 +28,9 @@ evaluator is created using @scheme[make-base-eval]. See also Uses of @scheme[code:comment] and @schemeidfont{code:blank} are stipped from each @scheme[datum] before evaluation. -If a @scheme[datum] has the form @scheme[(eval:alts #,(svar -show-datum) #,(svar eval-datum))], then @svar[show-datum] is typeset, -while @svar[eval-datum] is evaluated.} +If a @scheme[datum] has the form @scheme[(@#,indexed-scheme[eval:alts] +#,(svar show-datum) #,(svar eval-datum))], then @svar[show-datum] is +typeset, while @svar[eval-datum] is evaluated.} @defform*[[(interaction-eval datum)