@@ -29,12 +29,12 @@ import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate
2929import com.intellij.openapi.actionSystem.CommonDataKeys
3030import com.intellij.openapi.actionSystem.DataContext
3131import com.intellij.openapi.editor.Editor
32- import com.intellij.openapi.util.TextRange
3332import com.intellij.psi.PsiComment
3433import com.intellij.psi.PsiDocumentManager
3534import com.intellij.psi.PsiFile
3635
3736/* *
37+ * @Note Currently unused!
3838 * Inserts a * in each new line of a multi-line comment
3939 * @author patrick (04.12.17).
4040 */
@@ -54,19 +54,10 @@ class CommentStarInsertEnterHandler : MathematicaEnterHandler() {
5454 val document = editor.document
5555 val textLength = document.textLength
5656
57- // The case that we opened a comment with (*|) and therefore the complete file is commented
58- // We insert the missing *
59- if (comment.textRange.endOffset == textLength && offset < textLength && document.getText(TextRange .create(offset, offset + 1 )) == " )" ) {
60- document.insertString(offset, " * \n *" )
61- caretModel.moveToOffset(offset + 3 )
62- psiDocManager.commitDocument(document)
63- return EnterHandlerDelegate .Result .Stop
64- }
65-
66-
6757 val lineNumber = document.getLineNumber(offset)
6858 val elementStartLine = document.getLineNumber(comment.textOffset)
6959 val elementEndLine = document.getLineNumber(comment.textOffset + comment.textLength)
60+ val lineStartOffset = document.getLineStartOffset(lineNumber)
7061
7162 val insertString: String
7263 val move: Int
@@ -77,6 +68,7 @@ class CommentStarInsertEnterHandler : MathematicaEnterHandler() {
7768 insertString = " * "
7869 move = 2
7970 }
71+
8072 document.insertString(offset, insertString)
8173 caretModel.moveToOffset(offset + move)
8274
0 commit comments