/** * Terminal columns `text` occupies. Zero-width clusters (combining marks, default-ignorables) * count 0, wide clusters (CJK, emoji, fullwidth forms) count 2, everything else 1. ANSI escape * sequences are not counted, so a pre-coloured string measures as what the user sees — and the * slices below share that awareness, so a coloured string may be handed to either of them. */ export declare function displayWidth(text: string): number; /** * Terminal columns `text` occupies **at most** — the same measurement as {@link 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 {@link displayWidth}. */ export declare function maxDisplayWidth(text: string): number; /** * The first grapheme cluster of `text`, or `''` when it is empty — i.e. the smallest piece a cut * can leave behind, for a caller that has to make progress through a string one drawable glyph at * a time. */ export declare function firstCluster(text: string): string; /** * The longest LEADING run of whole clusters whose total width is at most `maxWidth` — i.e. keep * the head, lose the tail. Total (never throws): a non-positive `maxWidth` yields `''`. * * A cluster is kept only if it fits ENTIRELY, so the result can come back one column short of * `maxWidth` when the next cluster is two columns wide. That is the point: half a wide glyph * cannot be drawn, and spending the column anyway is how text over-runs its budget. * * The clusters are produced one at a time and the walk stops at the budget, so the cost is the * length of the RESULT rather than the length of the input — the input here is a whole tool-output * line, which is unbounded. */ export declare function sliceToWidth(text: string, maxWidth: number): string; /** * {@link sliceToWidth} measured by {@link maxDisplayWidth} — the head that fits the budget on any * terminal, whatever it does with Ambiguous characters. The cut for a budget that must hold rather * than merely look right. */ export declare function sliceToMaxWidth(text: string, maxWidth: number): string; /** * The longest TRAILING run of whole clusters whose total width is at most `maxWidth` — i.e. keep * the tail, lose the head. The mirror of {@link sliceToWidth}, for values whose end is the * informative part (a path's leaf directory). * * This one materialises the pieces: it walks backwards, and both cluster and sequence boundaries * are only derivable from the front. Its callers pass a path or a model id, so the input is a line * rather than a file. * * Keeping the END means the escapes that OPENED a style sit in the discarded head and go with it, * so a tail comes back in the terminal's default styling. Only the sequences inside the kept span * are carried, which leaves the tail ending in whatever state the whole string ended in — the cut * introduces no bleed of its own. */ export declare function sliceEndToWidth(text: string, maxWidth: number): string;