Clamp for all UTF-16 to offset conversions which used to use ToOffset

This commit is contained in:
Julia 2022-11-15 15:16:52 -05:00
parent f9cbed5a1f
commit bb32599ded
4 changed files with 43 additions and 39 deletions

View file

@ -70,8 +70,8 @@ impl DiagnosticSet {
Self {
diagnostics: SumTree::from_iter(
entries.into_iter().map(|entry| DiagnosticEntry {
range: buffer.anchor_before(entry.range.start)
..buffer.anchor_after(entry.range.end),
range: buffer.clamped_anchor_before(entry.range.start)
..buffer.clamped_anchor_after(entry.range.end),
diagnostic: entry.diagnostic,
}),
buffer,