Invalidate anchors when they get deleted (#14116)
Allows deleting the outputs directly within the editor. This also fixes the overlap logic to make sure that the ends and the starts are compared. https://github.com/zed-industries/zed/assets/836375/84f5f582-95f3-4c6a-a3c9-54da6009e34d Release Notes: - N/A --------- Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
018a2a29ea
commit
e51d469025
4 changed files with 72 additions and 9 deletions
|
@ -131,11 +131,7 @@ impl AnchorRangeExt for Range<Anchor> {
|
|||
}
|
||||
|
||||
fn overlaps(&self, other: &Range<Anchor>, buffer: &MultiBufferSnapshot) -> bool {
|
||||
let start_cmp = self.start.cmp(&other.start, buffer);
|
||||
let end_cmp = self.end.cmp(&other.end, buffer);
|
||||
|
||||
(start_cmp == Ordering::Less || start_cmp == Ordering::Equal)
|
||||
&& (end_cmp == Ordering::Greater || end_cmp == Ordering::Equal)
|
||||
self.end.cmp(&other.start, buffer).is_ge() && self.start.cmp(&other.end, buffer).is_le()
|
||||
}
|
||||
|
||||
fn to_offset(&self, content: &MultiBufferSnapshot) -> Range<usize> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue