bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 45e9a0fd338a2fbcd58023aec2cf6edac6f66cff
parent aaad15806809ec22d0bf9935abba847f76842b2c
Author: Matthew Flatt <mflatt@racket-lang.org>
Date:   Fri, 25 May 2012 06:41:25 -0600

scribble/eval: fix error line wrapping

The `wrap-line' function from `scribble/text/wrap' wants a
string that's a single line, so break the initial string
based on explicit lines, first.

original commit: 9b7ef7bf699c7997ad2c254827ca6528491a6f10

Diffstat:
Mcollects/scribble/eval.rkt | 19+++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt @@ -105,11 +105,14 @@ flow-accum)])))) (define (string->wrapped-lines str) - (wrap-line str maxlen - (λ (word fits) - (if ((string-length word) . > . maxlen) - (values (substring word 0 fits) (substring word fits) #f) - (values #f word #f))))) + (apply + append + (for/list ([line-str (regexp-split #rx"\n" str)]) + (wrap-line line-str maxlen + (λ (word fits) + (if ((string-length word) . > . maxlen) + (values (substring word 0 fits) (substring word fits) #f) + (values #f word #f))))))) (struct formatted-result (content)) @@ -128,7 +131,11 @@ (cond [(string? (caar val-list+outputs)) ;; Error result case: - (map (lambda (s) (car (format-output s error-color))) + (map (lambda (s) + (define p (format-output s error-color)) + (if (null? p) + (list null) + (car p))) (string->wrapped-lines (caar val-list+outputs)))] [(box? (caar val-list+outputs)) ;; Output written to a port