MCPcopy
hub / github.com/codeaashu/claude-code / sliceFit

Function sliceFit

src/ink/wrap-text.ts:10–13  ·  view source on GitHub ↗
(text: string, start: number, end: number)

Source from the content-addressed store, hash-verified

8// sliceAnsi may include a boundary-spanning wide char (e.g. CJK at position
9// end-1 with width 2 overshoots by 1). Retry with a tighter bound once.
10function sliceFit(text: string, start: number, end: number): string {
11 const s = sliceAnsi(text, start, end)
12 return stringWidth(s) > end - start ? sliceAnsi(text, start, end - 1) : s
13}
14
15function truncate(
16 text: string,

Callers 1

truncateFunction · 0.85

Calls 1

sliceAnsiFunction · 0.85

Tested by

no test coverage detected