@Override
  public void beforeDocumentChange(@NotNull DocumentEvent event) {
    if (myEditor.getDocument().isInBulkUpdate()) return;
    if (myInBatchMode) LOG.error("Document shouldn't be changed during batch inlay operation");
    int offset = event.getOffset();
    if (myConsiderCaretPositionOnDocumentUpdates && event.getOldLength() == 0 && offset == myEditor.getCaretModel().getOffset()) {
      List<Inlay<?>> inlays = getInlineElementsInRange(offset, offset);
      int inlayCount = inlays.size();
      if (inlayCount > 0) {
        VisualPosition inlaysStartPosition = myEditor.offsetToVisualPosition(offset, false, false);
        VisualPosition caretPosition = myEditor.getCaretModel().getVisualPosition();
        if (inlaysStartPosition.line == caretPosition.line &&
            caretPosition.column >= inlaysStartPosition.column && caretPosition.column <= inlaysStartPosition.column + inlayCount) {
          myInlaysAtCaret = inlays;
          for (int i = 0; i < inlayCount; i++) {
            ((InlayImpl<?, ?>)inlays.get(i)).setStickingToRight(i >= caretPosition.column - inlaysStartPosition.column);
          }
        }
      }
    }
  }
@Override
  public void beforeDocumentChange(@NotNull DocumentEvent event)