Skip to content

visibleWidth

visibleWidth(text): number

Defined in: visible-width.ts:40

The number of monospace columns text occupies once rendered.

Control characters contribute 0; each grapheme cluster contributes 1, or 2 if its leading code point is East Asian Wide/Fullwidth (CJK ideographs, most emoji) — unlike counting UTF-16 code units or code points, which under- and over-counts both of those.

string

number