void (final @NotNull Document document, final int startOffset, final int endOffset, final int indentLevel) { CharSequence chars = document.getCharsSequence(); int spaceEnd = CharArrayUtil.shiftForward(chars, startOffset, " \t"); final int startLine = document.getLineNumber(startOffset); if (spaceEnd > endOffset || indentLevel <= 0 || startLine >= document.getLineCount() - 1 || chars.charAt(spaceEnd) == '\n') { return; } int endLine = startLine + 1; while (endLine < document.getLineCount() && document.getLineStartOffset(endLine) < endOffset) endLine++; final String indentString = StringUtil.repeatSymbol(' ', indentLevel); indentLines(document, startLine + 1, endLine - 1, indentString); }