Skip to main content

delete_range

Function delete_range 

Source
pub fn delete_range(
    content: &[InlineContent],
    range: &SelectionRange,
) -> (Vec<InlineContent>, TextCursor)
Expand description

Deletes the content within a given range.

Handles:

  • Deletions within a single text run.
  • Deletions spanning multiple runs: the start/end runs are truncated, the runs strictly between them are dropped, and the two truncated runs are merged when they share the same style.

Non-text items (images, etc.) at the boundaries are left intact (their text offset resolves to 0), while intermediate non-text items are dropped along with the rest of the spanned content.