Fixed trivial bug in padded/both where the "odd space" was being emitted

on the left rather than the right as specified.

Fixed trivial bug in padded/left where a string longer than the provided
width would result in a call to make-string with a negative length.

Fixed trivial bug in trimmed/lazy around an fn-binding for the output
state variable.
This commit is contained in:
Jim Rees 2018-03-22 10:41:52 -04:00
parent ece2d470c3
commit b947e4ef47

View file

@ -115,7 +115,7 @@
(right (if (even? diff)
left
(make-string (+ 1 diff/2) pad-char))))
(each right str left))
(each left str right))
(displayed str)))))))
;;> As \scheme{padded/both} but only applies padding on the right.
@ -136,7 +136,7 @@
(lambda (str)
(fn (string-width pad-char)
(let ((diff (- width (string-width str))))
(each (make-string diff pad-char) str))))))
(each (make-string (max 0 diff) pad-char) str))))))
;; General buffered trim - capture the output apply a trimmer.
(define (trimmed/buffered width producer proc)
@ -211,7 +211,7 @@
;;> (e.g. \scheme{write-simple} on an infinite list). The nature of
;;> this procedure means only truncating on the right is meaningful.
(define (trimmed/lazy width . ls)
(fn (orig-output string-width)
(fn ((orig-output output) string-width)
(call-with-current-continuation
(lambda (return)
(let ((chars-written 0)