applyDeleteRules method

Delta applyDeleteRules(
  1. NotusDocument document,
  2. int index,
  3. int length
)

Applies heuristic rules to specified delete operation based on current state of Notus document.

Implementation

Delta applyDeleteRules(NotusDocument document, int index, int length) {
  final delta = document.toDelta();
  for (var rule in deleteRules!) {
    final result = rule.apply(delta, index, length);
    if (result != null) return result..trim();
  }
  throw StateError('Failed to apply delete heuristic rules: none applied.');
}