void (@NotNull Editor editor, @NotNull PySmartEnterProcessor processor, @NotNull PyStringLiteralExpression pyString) { final int offset = editor.getCaretModel().getOffset(); final Document document = editor.getDocument(); final int lineNum = document.getLineNumber(offset); final int lineStart = document.getLineStartOffset(lineNum); final int lineEnd = document.getLineEndOffset(lineNum); final String line = document.getText(TextRange.create(lineStart, lineEnd)); if (!StringUtil.isEmptyOrSpaces(line)) { final String trimmedLine = line.trim(); final String header = trimmedLine.endsWith(":") ? trimmedLine.substring(0, trimmedLine.length() - 1) : trimmedLine; if (SectionBasedDocString.isValidSectionTitle(header)) { final String patch = (trimmedLine.endsWith(":") ? "\n" : ":\n") + PyIndentUtil.getLineIndent(line) + GoogleCodeStyleDocStringBuilder.getDefaultSectionIndent(pyString.getContainingFile()); final int insertionOffset = lineStart + StringUtil.trimTrailing(line).length(); document.replaceString(insertionOffset, lineEnd, patch); processor.registerUnresolvedError(insertionOffset + patch.length()); } } }