@Override
  public int getOffset() {
    assertNotUpdating();
    ApplicationManager.getApplication().assertReadAccessAllowed();
    while (true) {
      PositionMarker marker = myPositionMarker;
      if (marker == null) return 0; // caret was disposed
      int startOffset = marker.getStartOffset();
      // double-checking to avoid "concurrent dispose and return -1 from already disposed marker" race
      if (marker.isValid() && marker == myPositionMarker) return startOffset;
    }
  }
@Override
  public int getOffset()