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
This commit is contained in:
Denis Zhdanov
2011-02-07 11:27:04 +03:00
parent 9414e45716
commit a58554e6d6
@@ -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));
}