MCPcopy
hub / github.com/chenglou/pretext / layout

Function layout

src/layout.ts:705–711  ·  view source on GitHub ↗
(prepared: PreparedText, maxWidth: number, lineHeight: number)

Source from the content-addressed store, hash-verified

703// - Trailing whitespace hangs past the line edge (doesn't trigger breaks)
704// - Segments wider than maxWidth are broken at grapheme boundaries
705export function layout(prepared: PreparedText, maxWidth: number, lineHeight: number): LayoutResult {
706 // Keep the resize hot path specialized. `layoutWithLines()` shares the same
707 // break semantics but also tracks line ranges; the extra bookkeeping is too
708 // expensive to pay on every hot-path `layout()` call.
709 const lineCount = countPreparedLines(getInternalPrepared(prepared), maxWidth)
710 return { lineCount, height: lineCount * lineHeight }
711}
712
713function createLayoutLine(
714 prepared: PreparedTextWithSegments,

Callers 9

runSweepFunction · 0.90
measureWidthFunction · 0.90
buildCorpusBenchmarksFunction · 0.90
runFunction · 0.90
buildProbeReportFunction · 0.90
renderFunction · 0.90
findTightWrapMetricsFunction · 0.90
computeLayoutFunction · 0.90
layout.test.tsFile · 0.85

Calls 2

countPreparedLinesFunction · 0.85
getInternalPreparedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…