mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Restored for consistency: "if line comment prefix is followed by a single space, uncomment line action deletes that space (PY-980)""
This reverts commit 0de5b6dd19224ee3d3992e92a04a9df24aa4066f.
This commit is contained in:
committed by
Dennis Ushakov
parent
df24cfb010
commit
ef275977d8
+9
-2
@@ -464,8 +464,15 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
|
||||
boolean commented = CharArrayUtil.regionMatches(chars, startOffset, prefix) ||
|
||||
(skipNewLine = prefix.endsWith(" ") && CharArrayUtil.regionMatches(chars, startOffset, prefix.trim() + "\n"));
|
||||
assert commented;
|
||||
int position = 0;//text.indexOf(prefix);
|
||||
myDocument.deleteString(position + startOffset , position + startOffset + (skipNewLine? prefix.trim().length():prefix.length()));
|
||||
|
||||
int charsToDelete = skipNewLine ? prefix.trim().length() : prefix.length();
|
||||
int theEnd = endOffset > 0 ? endOffset : chars.length();
|
||||
// if there's exactly one space after line comment prefix and before the text that follows in the same line, delete the space too
|
||||
if (startOffset + charsToDelete < theEnd-2 && chars.charAt(startOffset+charsToDelete) == ' ' &&
|
||||
chars.charAt(startOffset+charsToDelete+1) != ' ') {
|
||||
charsToDelete++;
|
||||
}
|
||||
myDocument.deleteString(startOffset, startOffset + charsToDelete);
|
||||
return;
|
||||
}
|
||||
String text = myDocument.getCharsSequence().subSequence(startOffset, endOffset).toString();
|
||||
|
||||
Reference in New Issue
Block a user