int (@NotNull CustomFoldRegion region) { if (myCachedHeight < 0) { Editor editor = region.getEditor(); int indent = 0; // optimize editor opening: skip 'proper' width calculation for 'Loading...' inlays if (myItem.getTextToRender() != null) { indent = calcInlayStartX() - editor.getInsets().left; } int width = Math.max(0, calcWidth(editor) - indent - scale(LEFT_INSET) - scale(RIGHT_INSET)); JComponent component = getRendererComponent(editor, width); return myCachedHeight = Math.max(editor.getLineHeight(), component.getPreferredSize().height + scale(TOP_BOTTOM_INSETS) * 2 + scale(TOP_BOTTOM_MARGINS) * 2); } else { return myCachedHeight; } }