Skip to main content

clamp

Function clamp 

Source
pub fn clamp<'t, P: Paragraph>(
    text: Text<&'t str, P::Font>,
    lines: usize,
) -> Cow<'t, str>
Expand description

text’s content, or the longest prefix of it that fits in lines lines with ELLIPSIS after it. Generic over the paragraph so a test can measure with a real one and no window.

“Fits” is both directions: no more than lines lines tall, and no wider than the bounds — which only an unwrapped text can be.