From 4506740d4a8334409ad0a873d490f44cdb22ba55 Mon Sep 17 00:00:00 2001 From: AlvoBen Date: Mon, 2 Dec 2024 15:21:08 +0200 Subject: [PATCH] add start index for asca problem --- .../com/checkmarx/intellij/inspections/AscaInspection.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } /**