int endOffset = -1;
for (int i = 0; i < myRelevantRangesInHostDocument.length; i++) {
RangeMarker hostRange = myRelevantRangesInHostDocument[i];
offset += myPrefixes[i].length();
int length = hostRange.getEndOffset() - hostRange.getStartOffset();
<BUG>TextRange intersection = new TextRange(offset, offset + length).intersection(rangeToEdit);
</BUG>
if (intersection != null) {
if (startOffset == -1) {
startOffset = intersection.getStartOffset();

int endOffset = -1;
for (int i = 0; i < myRelevantRangesInHostDocument.length; i++) {
RangeMarker hostRange = myRelevantRangesInHostDocument[i];
offset += myPrefixes[i].length();
int length = hostRange.getEndOffset() - hostRange.getStartOffset();
TextRange intersection = new ProperTextRange(offset, offset + length).intersection(rangeToEdit);
if (intersection != null) {
if (startOffset == -1) {
startOffset = intersection.getStartOffset();
