Skip to main content

replace_selection_with

Function replace_selection_with 

Source
pub fn replace_selection_with(
    value: &mut String,
    selection: &mut TextSelection,
    replacement: &str,
    opts: &TextInputOpts<'_>,
) -> usize
Expand description

replace_selection that respects TextInputOpts::max_length: the replacement is truncated (by character count) so the post-edit value doesn’t exceed the cap. Use this for paste / drop / IME commit flows where the field has a length cap. Returns the byte length of the actually-inserted text — useful when the caller wants to know whether the input was clipped.