fn find_break_pos(
        &self,
        width: usize,
        total_graphemes: usize,
        term_size: Vec2,
        slice: &TermString,
        is_inside: bool,
    ) -> usize {
        if width <= slice.len() {
            let mut pos = slice
                .index(.. coord::to_index(term_size.x))
                .iter()
                .rev()
                .position(|grapheme| grapheme == TermGrapheme::space())
                .map_or(width, |rev| total_graphemes - rev);
            if !is_inside {
                pos -= 1;
            }
            pos
        } else {
            total_graphemes
        }
    }
/// Finds the position where a line should break in a styled text.
Finds the position where a line should break in a styled text.
Finds the position where a line should break in a styled text .
fn find_break_pos(
        &self,
        width: usize,
        total_graphemes: usize,
        term_size: Vec2,
        slice: &TermString,
        is_inside: bool,
    ) -> usize {
        if width <= slice.len() {
            let mut pos = slice
                .index(.. coord::to_index(term_size.x))
                .iter()
                .rev()
                .position(|grapheme| grapheme == TermGrapheme::space())
                .map_or(width, |rev| total_graphemes - rev);
            if !is_inside {
                pos -= 1;
            }
            pos
        } else {
            total_graphemes
        }
    }
fn find_break_pos ( & self , width : usize , total_graphemes : usize , term_size : Vec2 , slice : & TermString , is_inside : bool , ) -> usize { if width <= slice . len ( ) { let mut pos = slice . index ( .. coord :: to_index ( term_size . x ) ) . iter ( ) . rev ( ) . position ( | grapheme | grapheme == TermGrapheme :: space ( ) ) . map_or ( width , | rev | total_graphemes - rev ) ; if ! is_inside { pos -= 1 ; } pos } else { total_graphemes } }
Finds the position where a line should break in a styled text.
Finds the position where a line should break in a styled text .
&self
width
usize
total_graphemes
usize
term_size
Vec2
slice
&TermString
is_inside
bool
&self
width
usize
total_graphemes
usize
term_size
Vec2
slice
&TermString
is_inside
bool