@Override
    void collectAffectedMarkersAndShiftSubtrees(@Nullable IntervalNode<FoldRegionImpl> root,
                                                   int start, int end, int lengthDelta,
                                                   @NotNull List<? super IntervalNode<FoldRegionImpl>> affected) {
      if (inCollectCall) {
        super.collectAffectedMarkersAndShiftSubtrees(root, start, end, lengthDelta, affected);
        return;
      }
      inCollectCall = true;
      try {
        super.collectAffectedMarkersAndShiftSubtrees(root, start, end, lengthDelta, affected);
      }
      finally {
        inCollectCall = false;
      }
      int oldLength = end - start;
      if (oldLength > 0 /* document change can cause regions to become equal*/) {
        for (Object o : affected) {
          //noinspection unchecked
          RMNode<FoldRegionImpl> node = (RMNode<FoldRegionImpl>)o;
          FoldRegionImpl region = getRegion(node);
          // region with the largest metric value is kept when several regions become identical after document change
          // we want the largest collapsed region to survive
          region.mySizeBeforeUpdate = region.isExpanded() ? 0 : node.intervalEnd() - node.intervalStart();
        }
      }
    }
@Override
    void collectAffectedMarkersAndShiftSubtrees(@Nullable IntervalNode<FoldRegionImpl> root,
                                                   int start, int end, int lengthDelta,
                                                   @NotNull List<? super IntervalNode<FoldRegionImpl>> affected)