Skip to main content

insert_text

Function insert_text 

Source
pub fn insert_text(
    content: &mut Vec<InlineContent>,
    cursor: &TextCursor,
    text_to_insert: &str,
) -> (Vec<InlineContent>, TextCursor)
Expand description

Inserts text at a cursor position.

The cursor’s affinity determines the exact insertion point:

  • Leading: Insert at the start of the referenced cluster (start_byte_in_run)
  • Trailing: Insert at the end of the referenced cluster (after the grapheme)