fn cursor_byte_index(edit: &TextEditing, text: &UiText) -> usize {
    text.text
        .grapheme_indices(true)
        .nth(edit.cursor_position as usize)
        .map(|i| i.0)
        .unwrap_or(text.text.len())
}
// Gets the byte index of the cursor.
Gets the byte index of the cursor.
Gets the byte index of the cursor .
fn cursor_byte_index(edit: &TextEditing, text: &UiText) -> usize {
    text.text
        .grapheme_indices(true)
        .nth(edit.cursor_position as usize)
        .map(|i| i.0)
        .unwrap_or(text.text.len())
}
fn cursor_byte_index ( edit : & TextEditing , text : & UiText ) -> usize { text . text . grapheme_indices ( true ) . nth ( edit . cursor_position as usize ) . map ( | i | i . 0 ) . unwrap_or ( text . text . len ( ) ) }
Gets the byte index of the cursor.
Gets the byte index of the cursor .
edit
&TextEditing
text
&UiText
edit
&TextEditing
text
&UiText