diff --git a/src/main/java/com/checkmarx/intellij/inspections/AscaInspection.java b/src/main/java/com/checkmarx/intellij/inspections/AscaInspection.java index c3184ac2..77482860 100644 --- a/src/main/java/com/checkmarx/intellij/inspections/AscaInspection.java +++ b/src/main/java/com/checkmarx/intellij/inspections/AscaInspection.java @@ -144,7 +144,11 @@ private String escapeHtml(String text) { private TextRange getTextRangeForLine(Document document, int lineNumber) { int startOffset = document.getLineStartOffset(lineNumber - 1); int endOffset = Math.min(document.getLineEndOffset(lineNumber - 1), document.getTextLength()); - return new TextRange(startOffset, endOffset); + + String lineText = document.getText(new TextRange(startOffset, endOffset)); + int trimmedStartOffset = startOffset + (lineText.length() - lineText.stripLeading().length()); + + return new TextRange(trimmedStartOffset, endOffset); } /**