Skip to content

Commit

Permalink
Fix for bug eclipse-jdt#1539
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-suliga committed Jan 15, 2025
1 parent 8d52085 commit b14ee04
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1279,23 +1279,15 @@ protected final IRegion alignRegion(IRegion region, FoldingStructureComputationC
IDocument document= ctx.getDocument();

try {

int start= document.getLineOfOffset(region.getOffset());
int end= document.getLineOfOffset(region.getOffset() + region.getLength());
int end= document.getLineOfOffset(region.getOffset() + region.getLength() - 1);
if (start >= end)
return null;

int offset= document.getLineOffset(start);
int endOffset;
if (document.getNumberOfLines() > end + 1)
endOffset= document.getLineOffset(end + 1);
else
endOffset= document.getLineOffset(end) + document.getLineLength(end);
int offset = document.getLineOffset(start);
int endOffset = document.getLineOffset(end);

return new Region(offset, endOffset - offset);

} catch (BadLocationException x) {
// concurrent modification
return null;
}
}
Expand Down

0 comments on commit b14ee04

Please sign in to comment.