@RequiresEdt
  public void invalidateRange(int startOffset, int endOffset, boolean invalidateSize) {
    int textLength = myDocument.getTextLength();
    if (startOffset > endOffset || startOffset >= textLength || endOffset < 0) {
      return;
    }
    int startLine = myDocument.getLineNumber(Math.max(0, startOffset));
    int endLine = myDocument.getLineNumber(Math.min(textLength, endOffset));
    myTextLayoutCache.invalidateLines(startLine, endLine);
    if (invalidateSize) {
      mySizeManager.invalidateRange(startOffset, endOffset);
    }
  }
@RequiresEdt
  public void invalidateRange(int startOffset, int endOffset, boolean invalidateSize)