MCPcopy Index your code
hub / github.com/codeaashu/claude-code / lineWidth

Function lineWidth

src/ink/line-width-cache.ts:10–24  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

8const MAX_CACHE_SIZE = 4096
9
10export function lineWidth(line: string): number {
11 const cached = cache.get(line)
12 if (cached !== undefined) return cached
13
14 const width = stringWidth(line)
15
16 // Evict when cache grows too large (e.g. after many different responses).
17 // Simple full-clear is fine — the cache repopulates in one frame.
18 if (cache.size >= MAX_CACHE_SIZE) {
19 cache.clear()
20 }
21
22 cache.set(line, width)
23 return width
24}
25

Callers 2

measureTextFunction · 0.85
widestLineFunction · 0.85

Calls 3

getMethod · 0.65
clearMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected