Fix more inlay_map corner cases and hangings

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Kirill Bulatov 2023-06-14 18:59:27 +03:00
parent 02e124cec4
commit bec9c26fa2
2 changed files with 23 additions and 11 deletions

View file

@ -90,15 +90,10 @@ impl Anchor {
if *self == Anchor::min() || *self == Anchor::max() {
true
} else if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
self.text_anchor.is_valid(&excerpt.buffer)
&& self
.text_anchor
.cmp(&excerpt.range.context.start, &excerpt.buffer)
.is_ge()
&& self
.text_anchor
.cmp(&excerpt.range.context.end, &excerpt.buffer)
.is_le()
excerpt.contains(self)
&& (self.text_anchor == excerpt.range.context.start
|| self.text_anchor == excerpt.range.context.end
|| self.text_anchor.is_valid(&excerpt.buffer))
} else {
false
}