don't add extra space to line comment prefix if it's there already

This commit is contained in:
Dmitry Jemerov
2013-01-25 17:38:01 +01:00
parent 10b479fa05
commit f59a91b406
@@ -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);