From b947e4ef47c67d6f1f69c8a15257c13837d0c6e2 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Thu, 22 Mar 2018 10:41:52 -0400 Subject: [PATCH] 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. --- lib/chibi/show/show.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chibi/show/show.scm b/lib/chibi/show/show.scm index 602736bf..d3c5e6a3 100644 --- a/lib/chibi/show/show.scm +++ b/lib/chibi/show/show.scm @@ -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)