VisualPosition (Editor editor) { HighlightInfo highlightInfo = getHighlightInfo(); if (highlightInfo == null) { return HoverDocPopupLocationProvider.Companion.getInstance().getPopupPosition(targetOffset, getElementForQuickDoc(), editor); } VisualPosition targetPosition = editor.offsetToVisualPosition(targetOffset); VisualPosition endPosition = editor.offsetToVisualPosition(highlightInfo.getEndOffset()); if (endPosition.line <= targetPosition.line) return targetPosition; Point targetPoint = editor.visualPositionToXY(targetPosition); Point endPoint = editor.visualPositionToXY(endPosition); Point resultPoint = new Point(targetPoint.x, endPoint.x > targetPoint.x ? endPoint.y : editor.visualLineToY(endPosition.line - 1)); return editor.xyToVisualPosition(resultPoint); }