delete method
Deletes length
of characters from this document starting at index
.
This method applies heuristic rules before modifying this document and produces a NotusChange with source set to ChangeSource.local.
Returns an instance of Delta
actually composed into this document.
Implementation
Delta delete(int index, int length) {
assert(index >= 0 && length > 0);
final change = _heuristics.applyDeleteRules(this, index, length);
if (change.isNotEmpty) {
// Delete rules are allowed to prevent the edit so it may be empty.
compose(change, ChangeSource.local);
}
return change;
}