pub fn bounded_truncate(output: &str) -> StringExpand description
Byte-based truncation with UTF-8 char-boundary safety.
Produces a head+tail slice bounded by DISPLAY_CAP bytes total, with a
single truncation marker line between them. Cuts snap to \n boundaries
(at most one line of drift) as a nicety, but the cap is enforced on the
ASSEMBLED slices: line-snapping may only ever shrink a slice relative to
its byte budget, never grow it past it (a single line can be arbitrarily
long — minified JS/JSON, base64). If the output has fewer than 2 newlines,
cuts fall back to char-boundary-only slicing. Never splits a multi-byte
UTF-8 sequence.
Returns the input unchanged when it is ≤ DISPLAY_CAP bytes.