pub fn floor_char_boundary(s: &str, idx: usize) -> usizeExpand description
Largest index <= idx that is a char boundary of s.
Offsets derived from byte arithmetic over possibly-multibyte text (UTF-8
CJK/emoji/box-drawing, the prompt glyphs, NBSP indentation) can land in the
middle of a code point. Slicing there panics. Snap down to the nearest
boundary so &s[floor_char_boundary(s, idx)..] is always valid. For ASCII
input this is the identity, so hot paths keep their existing behavior.