int (@NotNull Editor editor, int visualLineNumber) { int startOffset = editor.visualPositionToOffset(new VisualPosition(visualLineNumber, 0)); int endOffset = EditorUtil.getNotFoldedLineEndOffset(editor, startOffset); int offset = findFirstNonSpaceOffsetInRange(editor.getDocument().getImmutableCharSequence(), startOffset, endOffset); if (offset == -1) return -1; VisualPosition targetPosition = editor.offsetToVisualPosition(offset, true, false); return targetPosition.line == visualLineNumber ? targetPosition.column : -1; }