Skip to content

maxDisplayWidth

maxDisplayWidth(text): number

Defined in: packages/core/src/utils/displayWidth.ts:112

Terminal columns text occupies at most — the same measurement as displayWidth but counting East-Asian Ambiguous characters as two columns rather than one, which is the widest any terminal will render them.

For a budget that must hold on a terminal whose ambiguous-width policy is unknown, this is the only sound ruler: it is the supremum over the policies a terminal can be configured with, so a string that fits under it fits under all of them. See the module docblock for when to reach for this rather than displayWidth.

string

number