MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / wrapText

Function wrapText

source code/ink/wrap-text.ts:42–76  ·  view source on GitHub ↗
(
  text: string,
  maxWidth: number,
  wrapType: Styles['textWrap'],
)

Source from the content-addressed store, hash-verified

40}
41
42export default function wrapText(
43 text: string,
44 maxWidth: number,
45 wrapType: Styles['textWrap'],
46): string {
47 if (wrapType === 'wrap') {
48 return wrapAnsi(text, maxWidth, {
49 trim: false,
50 hard: true,
51 })
52 }
53
54 if (wrapType === 'wrap-trim') {
55 return wrapAnsi(text, maxWidth, {
56 trim: true,
57 hard: true,
58 })
59 }
60
61 if (wrapType!.startsWith('truncate')) {
62 let position: 'end' | 'middle' | 'start' = 'end'
63
64 if (wrapType === 'truncate-middle') {
65 position = 'middle'
66 }
67
68 if (wrapType === 'truncate-start') {
69 position = 'start'
70 }
71
72 return truncate(text, maxWidth, position)
73 }
74
75 return text
76}

Callers 2

wrapWithSoftWrapFunction · 0.70
measureTextNodeFunction · 0.70

Calls 1

truncateFunction · 0.70

Tested by

no test coverage detected