diff --git a/draw.rkt b/draw.rkt index ea6046e..b24a57d 100644 --- a/draw.rkt +++ b/draw.rkt @@ -337,15 +337,15 @@ (if (raart? col) col (text (~a col)))))) (define (para mw s #:halign [halign 'left]) - (para* mw (map text (string-split s " ")) #:halign halign)) -(define (para* mw rs #:halign [halign 'left]) + (para* mw (map text (string-split s " ")) #:halign halign #:gap (text " "))) +(define (para* mw rs #:halign [halign 'left] #:gap [gap (blank)]) (for/fold ([all-rows (list (blank))] #:result (vappend* #:halign halign (reverse all-rows))) ([r (in-list rs)]) (match-define (cons last-row rows) all-rows) (if (< (+ (raart-w last-row) (raart-w r)) mw) - (cons (happend last-row (text " ") r) rows) + (cons (happend last-row gap r) rows) (cons r all-rows)))) (define (draw-here r) @@ -436,7 +436,7 @@ (#:halign halign/c) raart?)] [para* (->* (exact-nonnegative-integer? (listof raart?)) - (#:halign halign/c) + (#:halign halign/c #:gap raart?) raart?)] [if-drawn (-> (-> exact-nonnegative-integer? exact-nonnegative-integer? exact-nonnegative-integer? exact-nonnegative-integer? diff --git a/raart.scrbl b/raart.scrbl index 20ae5d2..cacc74c 100644 --- a/raart.scrbl +++ b/raart.scrbl @@ -210,7 +210,7 @@ raart?]{Like @racket[happend], but accepts arguments as a list. @ex[(draw-here (para 45 "And it came to pass that I, Nephi, said unto my father: I will go and do the things which the Lord hath commanded, for I know that the Lord giveth no commandments unto the children of men, save he shall prepare a way for them that they may accomplish the thing which he commandeth them."))]} -@defproc[(para* [max-width exact-nonnegative-integer?] [rs (listof raart?)] [#:halign halign halign/c 'left]) raart?]{Like @racket[happend*], but limits the total width and uses @racket[vappend] when things get too long. @racket[para] uses this after splitting the input string into words.} +@defproc[(para* [max-width exact-nonnegative-integer?] [rs (listof raart?)] [#:halign halign halign/c 'left] [#:gap gap raart? (blank)]) raart?]{Like @racket[happend*], but limits the total width and uses @racket[vappend] when things get too long. @racket[para] uses this after splitting the input string into words and supplies @racket[(text " ")] as the @racket[gap].} @defproc[(place-at [back raart?] [dr exact-nonnegative-integer?] [dh exact-nonnegative-integer?] [front raart?]) raart?]{Renders