capToolDisplayLines
capToolDisplayLines(
lines,maxLines?):ToolDisplayLine[]
Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/toolDisplay.ts:706
Apply the canonical render cap: at most maxLines lines (each char-capped at
TOOL_PREVIEW_LINE_MAX_CHARS with …), plus a dim … (+N more lines) overflow
marker when anything was cut. The marker line is IN ADDITION to the cap so exactly how much
was hidden is always stated (DL-4 transparency).
This stays a GENERIC width utility and does not neutralise: it measures a line by what it RENDERS as, so a caller passing genuinely styled text (the renderer’s own SGR) gets a cap that counts the columns the user sees rather than the escapes’ own bytes.
No production caller passes styled text today. buildToolPreviewLines is the only one, and its lines arrive already neutralised from buildToolBodyLines, so on the tool path there is nothing left to discount. The discount is kept because this is public API — core exports every module — and a width utility that mismeasured styled text would be wrong for any caller that did pass some. It is a property of the utility, not a live requirement of the tool path, and the spec covering it says the same.
Parameters
Section titled “Parameters”maxLines?
Section titled “maxLines?”number = TOOL_OUTPUT_PREVIEW_LINES