/** * Unicode utilities for terminal cell width calculation, grapheme segmentation, * and ANSI sequence handling. * * Ported from blessed/teaui's unicode.js — battle-tested character width tables. */ /** Special character used by viewport.paint for background drawing. */ export declare const BG_DRAW = "\u0014"; export interface AnsiLocation { start: number; stop: number; ansi: string; } /** * Returns the number of *cells* that the first character of the string takes up. * * "Cell" refers to a terminal space: ASCII characters take 1 cell, Emoji and Asian * characters take 2 cells. ANSI codes (\x1b[...) return 0. */ export declare function charWidth(str: string): 0 | 1 | 2; /** * Return the cell width and height of the entire string. Width is the maximum * length of all the lines, and height is the number of lines. */ export declare function stringSize(text: string | string[]): { width: number; height: number; }; /** * Return the cell width and height of the entire string, wrapping lines to fit * within maxWidth. */ export declare function stringSize(text: string | string[], maxWidth: number): { width: number; height: number; }; /** * Returns the number of cells that the first line of the string takes up. */ export declare function lineWidth(str: string | string[]): number; export declare function getLocale(): string; export declare function setLocale(value: string): void; /** * @param input String or array of graphemes. * @returns [grapheme[], offset][] Array of tuples. Each tuple is an array of * graphemes and starting string offset. ANSI codes are preserved. */ export declare function words(input: string | string[]): [string[], number][]; /** * Breaks the string up into graphemes: single ASCII/Emoji characters, and ANSI * sequences. */ export declare function printableChars(str: string): string[]; /** * Returns an array of ranges indicating where the string includes ANSI sequences. * @param input The string to scan. * @param includeLast If true, there will always be a range at the end of the * string, to make looping over the ranges easier. */ export declare function ansiLocations(input: string, includeLast?: boolean): AnsiLocation[]; /** * Removes ANSI color/style sequences. */ export declare function removeAnsi(input: string): string; /** * Not all terminals treat characters the same way. I only care about TeaUI * characters here. */ export declare function isAnnoyingWidth(input: string): input is "⬛︎" | "⬜︎"; //# sourceMappingURL=unicode.d.ts.map