Skip to content

Commit

Permalink
add start index for asca problem
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAlvo1 committed Dec 2, 2024
1 parent 85cfdac commit 4506740
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 4506740

Please sign in to comment.