fix inclusive offsets in cpp test
This commit is contained in:
@ -76,14 +76,13 @@ final class FragmentedTextDocument extends BaseMappedDocument implements TextDoc
|
|||||||
lastAccessedFragment = f;
|
lastAccessedFragment = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inclusive && f.outEnd() == outOffset) {
|
if (inclusive && f.outEnd() == outOffset && f.next != null) {
|
||||||
if (f.next != null) {
|
// Inclusive means, the offset must correspond to a character in the source document.
|
||||||
|
// Here we have to skip forward to the fragment that contains the character, because
|
||||||
|
// it's not this one.
|
||||||
|
do {
|
||||||
f = f.next;
|
f = f.next;
|
||||||
lastAccessedFragment = f;
|
} while (f.next != null && f.outLen() == 0);
|
||||||
// fallthrough
|
|
||||||
} else {
|
|
||||||
return f.outToIn(outOffset) + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return f.outToIn(outOffset);
|
return f.outToIn(outOffset);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
[Image] or [Truncated image[ Bcol Ecol
|
[Image] or [Truncated image[ Bcol Ecol
|
||||||
L1
|
L1
|
||||||
[void] 1 2
|
[void] 1 2
|
||||||
L5
|
L6
|
||||||
[main] 2 2
|
[main] 1 2
|
||||||
L9
|
|
||||||
[(] 2 2
|
|
||||||
L10
|
L10
|
||||||
[)] 2 2
|
[(] 1 2
|
||||||
L12
|
L11
|
||||||
[{] 2 2
|
[)] 1 2
|
||||||
L14
|
L13
|
||||||
[}] 2 2
|
[{] 1 2
|
||||||
|
L15
|
||||||
|
[}] 1 2
|
||||||
EOF
|
EOF
|
||||||
|
Reference in New Issue
Block a user