Back to API Reference
Struct

EditShape

sealed

The shape of one document mutation: Removed codepoints replaced by Inserted codepoints at Start. Produced by every gap-buffer mutation; consumers use it to patch derived indexed state (range maps, cached counts, undo history) instead of recomputing from the whole document.

public int Delta{ get }

Net change in document codepoint count.

[ctor]public EditShape()
public int MapIndex()

Maps a codepoint index valid before this edit to the equivalent index after it: indices before Start are unchanged, indices at or after the removed range shift by Delta (an index exactly at a pure insertion point moves after the inserted text), and indices strictly inside the removed range collapse to Start.

public readonly int Start
public readonly int Removed
public readonly int Inserted