From a58554e6d65103a657e95093306f944b93e25f75 Mon Sep 17 00:00:00 2001 From: Denis Zhdanov Date: Mon, 7 Feb 2011 11:25:36 +0300 Subject: [PATCH] IDEA-65108 Inserting line break in text file can cause incorrect formatting and cursor placement on new line if the original line starts with an asterisk Javadoc-like processing is corrected for plain text files --- .../intellij/codeInsight/editorActions/EnterHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java index 904372541275..a43924d10098 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java @@ -259,8 +259,8 @@ public class EnterHandler extends BaseEnterHandler { final PsiElement parent = element.getParent(); if (text.equals(commentContext.commenter.getDocumentationCommentPrefix()) && isDocComment(parent, commentContext.commenter) || - text.startsWith(commentContext.commenter.getDocumentationCommentPrefix()) && element instanceof PsiComment - ) { + text.startsWith(commentContext.commenter.getDocumentationCommentPrefix()) && element instanceof PsiComment) + { PsiComment comment = isDocComment(parent, commentContext.commenter) ? (PsiComment)parent:(PsiComment)element; int commentEnd = comment.getTextRange().getEndOffset(); @@ -321,7 +321,7 @@ public class EnterHandler extends BaseEnterHandler { String indentInsideJavadoc = null; int line = myDocument.getLineNumber(myOffset); - if (line > 0) { + if (line > 0 && (commentContext.docAsterisk || commentContext.docStart)) { indentInsideJavadoc = CodeDocumentationUtil.getIndentInsideJavadoc(myDocument, myDocument.getLineStartOffset(line - 1)); }