public void handleBeforeDocumentChange(@NotNull Side side, @NotNull DocumentEvent e) {
    if (myValidChanges.isEmpty()) return;

    LineRange lineRange = DiffUtil.getAffectedLineRange(e);
    int shift = DiffUtil.countLinesShift(e);

    Set<SimpleDiffChange> invalidated = new HashSet<>();
    for (SimpleDiffChange change : myValidChanges) {
      if (change.processDocumentChange(lineRange.start, lineRange.end, shift, side)) {
        invalidated.add(change);

        SimpleDiffChangeUi changeUi = myPresentations.get(change.getIndex());
        if (changeUi != null) changeUi.invalidate();
      }
    }

    myValidChanges.removeAll(invalidated);
  }
public void handleBeforeDocumentChange(@NotNull Side side, @NotNull DocumentEvent e)