mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
comment by block: fix intersection inference
This commit is contained in:
+4
-3
@@ -225,12 +225,13 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
|
||||
}
|
||||
|
||||
private boolean isWhiteSpaceOrComment(@NotNull PsiElement element, @NotNull TextRange range) {
|
||||
TextRange intersection = range.intersection(element.getTextRange());
|
||||
final TextRange textRange = element.getTextRange();
|
||||
TextRange intersection = range.intersection(textRange);
|
||||
if (intersection == null) {
|
||||
return false;
|
||||
}
|
||||
intersection = TextRange.from(Math.max(intersection.getStartOffset() - element.getTextRange().getStartOffset(), 0),
|
||||
Math.min(intersection.getEndOffset() - element.getTextRange().getStartOffset(), element.getTextRange().getLength()));
|
||||
intersection = TextRange.create(Math.max(intersection.getStartOffset() - textRange.getStartOffset(), 0),
|
||||
Math.min(intersection.getEndOffset() - textRange.getStartOffset(), textRange.getLength()));
|
||||
return isWhiteSpaceOrComment(element) ||
|
||||
intersection.substring(element.getText()).trim().length() == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user