Create a StringWidth instance.
Optional
opts: StringWidthOptions = {}Is the context for ambiguous East Asian Width code points CJK?
Resolved locale for grapheme segmentation.
Break a string into multiple parts, such that each part has maximum cell length of width, unless a particular grapheme cluster is longer than width. Therefore, width should probably be 4 or higher to get the expected results.
String to segment
Maximum number of display cells for chunks
Compute the widths of strings in display terminal "cells" of horizontal space. Intuitionally, a plain ASCII character takes up one cell. Certain grapheme clusters may take up -1 (e.g. backspace), 0 (e.g. escape sequences), 1, or 2 (e.g. emoji) cells.
ANSI escape sequences are stripped by default. This can be disabled by setting the includeANSI option. Escape sequences that are paired with a start sequence and a stop sequence will be processed much more gracefully than individual sequences (e.g. cursor movements) or overlapping pairs.