MCPcopy Create free account
hub / github.com/codeaashu/claude-code / drainProportional

Function drainProportional

src/ink/render-node-to-output.ts:161–176  ·  view source on GitHub ↗
(
  node: DOMElement,
  pending: number,
  innerHeight: number,
)

Source from the content-addressed store, hash-verified

159// Native proportional drain. step = max(MIN, floor(abs*3/4)), capped at
160// innerHeight-1 so DECSTBM + blit+shift fast path fire.
161function drainProportional(
162 node: DOMElement,
163 pending: number,
164 innerHeight: number,
165): number {
166 const abs = Math.abs(pending)
167 const cap = Math.max(1, innerHeight - 1)
168 const step = Math.min(cap, Math.max(SCROLL_MIN_PER_FRAME, (abs * 3) >> 2))
169 if (abs <= step) {
170 node.pendingScrollDelta = undefined
171 return pending
172 }
173 const applied = pending > 0 ? step : -step
174 node.pendingScrollDelta = pending - applied
175 return applied
176}
177
178// OSC 8 hyperlink escape sequences. Empty params (;;) — ansi-tokenize only
179// recognizes this exact prefix. The id= param (for grouping wrapped lines)

Callers 1

renderNodeToOutputFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected