private boolean isAffectedByFormatting(final Block block) {
    if (myAffectedRanges == null) return true;

    List<FormatTextRange> allRanges = myAffectedRanges.getRanges();
    Document document = myModel.getDocument();
    int docLength = document.getTextLength();

    for (FormatTextRange range : allRanges) {
      int startOffset = range.getStartOffset();
      if (startOffset >= docLength) continue;

      int lineNumber = document.getLineNumber(startOffset);
      int lineEndOffset = document.getLineEndOffset(lineNumber);

      int blockStartOffset = block.getTextRange().getStartOffset();
      if (blockStartOffset >= startOffset && blockStartOffset < lineEndOffset) {
        return true;
      }
    }

    return false;
  }
private boolean isAffectedByFormatting(final Block block)