VisualPosition () { int offset = getOffset(); int logicalLine = myEditor.getDocument().getLineNumber(offset); int lineEndOffset = myEditor.getDocument().getLineEndOffset(logicalLine); VisualPosition position = myEditor.offsetToVisualPosition(lineEndOffset, true, true); if (myEditor.getFoldingModel().isOffsetCollapsed(lineEndOffset)) return position; List<Inlay<?>> inlays = myEditor.getInlayModel().getAfterLineEndElementsForLogicalLine(logicalLine); int order = inlays.indexOf(this); return new VisualPosition(position.line, position.column + 1 + order); }