You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-widthstringWidth("🇪…") 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)
The text was updated successfully, but these errors were encountered:
erictheswift
changed the title
Country flags consisting of multiple codepoints are being exploded
Graphemes consisting of multiple codepoints break the truncation invariant
Jan 10, 2024
erictheswift
changed the title
Graphemes consisting of multiple codepoints break the truncation invariant
Some graphemes (e.g. country flags) break the truncation invariant
Jan 10, 2024
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#35Got here debugging ink truncation issue when line had country flag on box wrap edge)
The text was updated successfully, but these errors were encountered: