boolean (@NotNull ActionChangeRange lastRange, @NotNull ActionChangeRange newRange) { if (areSymmetric(lastRange, newRange)) { if (lastRange.getOldLength() == 0) { return true; // `lastRange` inserts some fragment which is then erased by `newRange` } if (lastRange.getOriginatorId() == newRange.getOriginatorId()) { return true; // `lastRange` and `newRange` refer to the same undoable action } } return false; }