Skip to main content

grapheme_boundary_at_or_before

Function grapheme_boundary_at_or_before 

pub fn grapheme_boundary_at_or_before(text: &str, byte_idx: usize) -> usize
Expand description

The nearest extended-grapheme boundary at or before byte_idx.

This is the safe place to clamp carets after remote edits: a UTF-8 scalar boundary may still sit inside a combining sequence or emoji ZWJ cluster.