@Override
  public void beforeDocumentChange(@NotNull DocumentEvent event) {
    assertValidState(); // should be called at the start, as it can initiate soft wrap calculations
    myAfterLineEndInlayUpdated = false;
    myDuringDocumentUpdate = true;
    if (myDocument.isInBulkUpdate()) return;
    final int offset = event.getOffset();
    // Although the result of getMoveOffset() can point to invalid offset when used from within beforeDocumentChange(),
    // the actual value is not used until doInvalidateRange() called from documentChanged().
    final int moveOffset = DocumentEventUtil.isMoveInsertion(event) ? event.getMoveOffset() : offset;
    final int length = event.getNewLength();
    myDocumentChangeStartOffset = Math.min(offset, moveOffset);
    myDocumentChangeEndOffset = Math.max(offset, moveOffset) + length;
  }
@Override
  public void beforeDocumentChange(@NotNull DocumentEvent event)