@NotNull
  @ApiStatus.Internal
  public static LineRange getPaintedInterval(@NotNull Editor editor, @NotNull IntPair yRange) {
    int visibleAreaYOffset = editor.getScrollingModel().getVerticalScrollOffset();
    // convert editor coordinates to editor component coordinates
    int yStart = visibleAreaYOffset + yRange.first;
    int yEnd = visibleAreaYOffset + yRange.second;
    if (yStart >= yEnd) return new LineRange(0, 0);
    return ReadAction.compute(() -> {
      LogicalPosition position1 = editor.xyToLogicalPosition(new Point(0, yStart));
      LogicalPosition position2 = editor.xyToLogicalPosition(new Point(0, yEnd));
      return new LineRange(position1.line, position2.line);
    });
  }
@NotNull
  @ApiStatus.Internal
  public static LineRange getPaintedInterval(@NotNull Editor editor, @NotNull IntPair yRange)