int[] (int line) { if (line < 0) line = 0; int offset = line >= myView.getEditor().getVisibleLineCount() ? myDocument.getTextLength() + 1 : visualLineToOffset(line); int lineHeight = myView.getLineHeight(); FoldingModelImpl foldingModel = myView.getEditor().getFoldingModel(); int idx = foldingModel.getLastCollapsedRegionBefore(offset); IntPair adjustment = foldingModel.getCustomRegionsYAdjustment(offset, idx); int startY = myView.getInsets().top + line * lineHeight + adjustment.first + myView.getEditor().getInlayModel().getHeightOfBlockElementsBeforeVisualLine(line, offset, idx); return new int[] {startY, startY + lineHeight + adjustment.second}; }