visibleWidth
Generated reference page for the visibleWidth function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/help/ansi.ts - Source link:
src/core/help/ansi.ts:51
Signatures
ts
function visibleWidth(text: string): number;| Parameter | Type | Description |
|---|---|---|
text | string | Text possibly containing terminal escapes. |
Members
Members
visibleWidth
Measure the visible column width of text, ignoring ANSI/OSC escapes.
Escape sequences (SGR colors, OSC 8 hyperlinks) occupy zero columns when rendered, so .length overcounts whenever they are present. Help formatting uses this for padding and wrapping; exported for custom help renderers that mix colors or links into aligned output.
ts
(text: string): number;Examples
ts
visibleWidth('plain'); // 5
visibleWidth(osc8('https://x.dev', 'x')); // 1