@NotNull
  Point2D visualPositionToXY(@NotNull VisualPosition pos) {
    int visualLine = pos.line;
    int column = pos.column;
    int y = visualLineToY(visualLine);
    float x = getStartX(visualLine);
    int lastColumn = 0;
    int logicalLine = -1;
    if (visualLine < myView.getEditor().getVisibleLineCount()) {
      int visualLineStartOffset = visualLineToOffset(visualLine);
      int maxOffset = 0;
      for (VisualLineFragmentsIterator.Fragment fragment : VisualLineFragmentsIterator.create(myView, visualLineStartOffset, false, true)) {
        if (fragment.getCurrentFoldRegion() instanceof CustomFoldRegion) {
          return new Point2D.Double(fragment.getStartX(), y);
        }
        int startVisualColumn = fragment.getStartVisualColumn();
        if (column < startVisualColumn || column == startVisualColumn && !pos.leansRight) {
          break;
        }
        int endColumn = fragment.getEndVisualColumn();
        if (column < endColumn || column == endColumn && !pos.leansRight) {
          return new Point2D.Double(fragment.visualColumnToX(column), y);
        }
        x = fragment.getEndX();
        lastColumn = endColumn;
        maxOffset = Math.max(maxOffset, fragment.getMaxOffset());
        logicalLine = fragment.getEndLogicalLine();
      }
      if (column > lastColumn && myView.getEditor().getSoftWrapModel().getSoftWrap(maxOffset) != null) {
        column--;
        x += myView.getEditor().getSoftWrapModel().getMinDrawingWidthInPixels(SoftWrapDrawingType.BEFORE_SOFT_WRAP_LINE_FEED);
      }
      else if (logicalLine == -1) {
        logicalLine = myDocument.getLineNumber(visualLineStartOffset);
      }
    }
    if (column > lastColumn + 1 && logicalLine >= 0) {
      List<Inlay<?>> inlays = myView.getEditor().getInlayModel().getAfterLineEndElementsForLogicalLine(logicalLine);
      int inlaysWidth = 0;
      int inlayCount = 0;
      for (Inlay inlay : inlays) {
        inlayCount++;
        inlaysWidth += inlay.getWidthInPixels();
        if (column == lastColumn + 1 + inlayCount) {
          break;
        }
      }
      x += inlaysWidth;
      column -= inlayCount;
    }
    float additionalShift = column <= lastColumn ? 0 : (column - lastColumn) * myView.getPlainSpaceWidth();
    return new Point2D.Double(x + additionalShift, y);
  }
@NotNull
  Point2D visualPositionToXY(@NotNull VisualPosition pos)