MCPcopy
hub / github.com/Doorman11991/smallcode / visualLength

Function visualLength

src/tui/utils.js:23–27  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

21}
22
23function visualLength(str) {
24 let len = 0;
25 for (const ch of str) len += visualWidth(ch);
26 return len;
27}
28
29function fitAnsi(str, width, { align = 'left', ellipsis = false, pad = true } = {}) {
30 if (width <= 0) return '';

Callers 3

tui_layout.test.jsFile · 0.85
_computeLayoutMethod · 0.85
_renderInputMethod · 0.85

Calls 1

visualWidthFunction · 0.85

Tested by

no test coverage detected