Skip to main content

create_delete_selection_changeset

Function create_delete_selection_changeset 

Source
pub fn create_delete_selection_changeset(
    target: DomNodeId,
    forward: bool,
    timestamp: Instant,
    layout_window: &LayoutWindow,
) -> Option<TextChangeset>
Expand description

Creates a delete changeset for the current selection or single character.

If there is an active selection, deletes the entire selection. If there is only a cursor (no selection), deletes a single character:

  • forward = true (Delete key): deletes the character after the cursor
  • forward = false (Backspace): deletes the character before the cursor

Returns None if there is nothing to delete (e.g., cursor at document boundary).