Trimming procedures Marc Nieper-Wißkirchen (21 Feb 2019 09:36 UTC)
Re: Trimming procedures Marc Nieper-Wißkirchen (22 Feb 2019 17:59 UTC)

Trimming procedures Marc Nieper-Wißkirchen 21 Feb 2019 09:36 UTC

(1) The reference implementation uses the "substring" procedure to
trim a string that does not fit in the width. However, this is not
quite correct if the string contains characters for which
"string-width" is not 1.

A correct implementation would have to apply string-width character by
character as long as the string is still too wide.

(2) In trimmed/both, trimming has to be evenly distributed between the
left hand and the right hand side. Do we want to distribute by
character width or by character count? (Character count is probably
correct.)

(3) The SRFI specifies for trimmed, trimmed/right and trimmed/both
that: "As soon as any of the fmts exceeds width, stop formatting and
truncate the result, returning control to whoever called trimmed."

The reference implementation does not honor that but formats all fmts
before trimming.