Am Di., 16. Juni 2020 um 10:30 Uhr schrieb Alex Shinn <xxxxxx@gmail.com>:
It is part of the spec, as noted in two places, in the description of as-unicode:

  Padding, trimming and tabbing, etc. will generally not
  do the right thing in the presence of zero-width and
  double-width Unicode characters, or ANSI escapes

and in item 6 of the unicode-terminal-width spec:

  ANSI terminal escapes, as output by the color formatters above, count as 0 columns

My fault. I don't know how I managed it but I missed that comment. :)
 
Regarding the comment, it is a minor detail - in particular, using as-color it's impossible to split an ANSI escape across multiple strings.  I can add a note that the behavior is undefined if an ANSI escape is split.

Can't we just repair this? The mechanism we have to use to repair this may also be of interest to other (user-provided) formatters. Wouldn't it help to make the underlying splitters (and trimmers) parameters (state variables) parameterizable and provide special (slower) versions that split/trim escapes/unicode strings correctly and which can be installed by the user?

Marc