Change summary
crates/buffer/src/lib.rs | 6 +++++-
crates/language/src/lib.rs | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
Detailed changes
@@ -570,7 +570,7 @@ impl Buffer {
}
pub fn clip_point(&self, point: Point, bias: Bias) -> Point {
- self.visible_text.clip_point(point, bias)
+ self.content().clip_point(point, bias)
}
pub fn clip_offset(&self, offset: usize, bias: Bias) -> usize {
@@ -1899,6 +1899,10 @@ impl<'a> Content<'a> {
FullOffset(summary.visible + summary.deleted + overshoot)
}
+ pub fn clip_point(&self, point: Point, bias: Bias) -> Point {
+ self.visible_text.clip_point(point, bias)
+ }
+
fn point_for_offset(&self, offset: usize) -> Result<Point> {
if offset <= self.len() {
Ok(self.text_summary_for_range(0..offset).lines)
@@ -711,7 +711,9 @@ impl Buffer {
end = last_edit_new_end + (end - last_edit_old_end);
}
- Some((start..end, (severity, diagnostic.message)))
+ let range =
+ content.clip_point(start, Bias::Left)..content.clip_point(end, Bias::Right);
+ Some((range, (severity, diagnostic.message)))
}),
)
};