StringBuilder (final CommonCodeStyleSettings.IndentOptions indentOptions, final int offset, final IndentInfo indent) { final StringBuilder result = new StringBuilder(); int currentOffset = getStartOffset(); CharSequence[] lines = getInitialLines(); int currentLine = 0; for (int i = 0; i < lines.length - 1 && currentOffset + lines[i].length() <= offset; i++) { result.append(lines[i]); currentOffset += lines[i].length(); result.append(LINE_FEED); currentOffset++; currentLine++; if (currentOffset == offset) { break; } } final String newIndentSpaces = indent.generateNewWhiteSpace(indentOptions); result.append(newIndentSpaces); appendNonWhitespaces(result, lines, currentLine); if (currentLine + 1 < lines.length) { result.append(LINE_FEED); for (int i = currentLine + 1; i < lines.length - 1; i++) { result.append(lines[i]); result.append(LINE_FEED); } appendNonWhitespaces(result, lines, lines.length - 1); result.append(lines[lines.length - 1]); } return result; }