Skip to main content

wrap_end

Function wrap_end 

Source
pub fn wrap_end(
    s: &str,
    pos: usize,
    pe: usize,
    fits: &mut dyn FnMut(usize, usize) -> bool,
) -> usize
Expand description

where a line starting at pos ends inside pos..pe (pos < end <= pe; pe when pos == pe): the whole rest when it fits, else the last break opportunity whose text before it (without trailing spaces) fits, else grapheme clusters while they fit (at least one); a mandatory break inside ends the line there. fits(a, b): the text a..b fits.