Considering cli-truncate
works with terminal char widths, I think this expectation is valid:
expect(cliTruncate('πͺπΊ!', 2)).toEqual('β¦')
However due to country flags consisting of multiple code points treated as separate chars in slice-ansi
, cliTruncate returns "πͺβ¦"
This is not only rendering artifact but a broken invariant, e.g. string-width stringWidth("πͺβ¦")
returns 3 that is above requested width 2.
using Intl.Segmenter in slice-ansi
can be possible way to fix it: chalk/slice-ansi#35
Got here debugging ink truncation issue when line had country flag on box wrap edge)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too