default @NotNull ProperTextRange calculateVisibleRange() {
    ThreadingAssertions.assertEventDispatchThread();
    return ReadAction.compute(() -> {
      Rectangle rect = getScrollingModel().getVisibleArea();
      LogicalPosition startPosition = xyToLogicalPosition(new Point(rect.x, rect.y));
      int visibleStart = logicalPositionToOffset(startPosition);
      LogicalPosition endPosition = xyToLogicalPosition(new Point(rect.x + rect.width, rect.y + rect.height));
      int visibleEnd = logicalPositionToOffset(new LogicalPosition(endPosition.line + 1, 0));
      return new ProperTextRange(visibleStart, Math.max(visibleEnd, visibleStart));
    });
  }
default @NotNull ProperTextRange calculateVisibleRange()