From f59a91b40669c471b69626288697e78af7bbd99a Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 25 Jan 2013 17:23:16 +0100 Subject: [PATCH] don't add extra space to line comment prefix if it's there already --- .../editorActions/enter/EnterInLineCommentHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java index 4bc679c2e78d..1096db13522d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterInLineCommentHandler.java @@ -49,7 +49,7 @@ public class EnterInLineCommentHandler extends EnterHandlerDelegateAdapter { String prefix = commenter.getLineCommentPrefix(); assert prefix != null: "Line Comment type is set but Line Comment Prefix is null!"; if (!StringUtil.startsWith(text, offset, prefix)) { - if (text.charAt(caretOffset) != ' ') { + if (text.charAt(caretOffset) != ' ' && !prefix.endsWith(" ")) { prefix += " "; } document.insertString(caretOffset, prefix);