int (@NotNull FoldRegion region, int visualColumn, boolean leansRight) { if (visualColumn < 0 || visualColumn == 0 && !leansRight) return 0; String text = region.getPlaceholderText(); for (LineLayout.VisualFragment fragment : getFoldRegionLayout(region).getFragmentsInVisualOrder(0)) { int startVC = fragment.getStartVisualColumn(); int endVC = fragment.getEndVisualColumn(); if (visualColumn > startVC && visualColumn < endVC || visualColumn == startVC && leansRight || visualColumn == endVC && !leansRight) { int logicalColumn = fragment.visualToLogicalColumn(visualColumn); return LogicalPositionCache.calcOffset(text, logicalColumn, 0, 0, text.length(), getTabSize()); } } return text.length(); }