From b43c78053bf57f9ceaba1cf5e4e916c9a964293a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 11 Oct 2021 09:37:21 +0200 Subject: [PATCH] Always use `seek_forward` when resolving anchors --- crates/buffer/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/buffer/src/lib.rs b/crates/buffer/src/lib.rs index c4409531b1..182eabcc12 100644 --- a/crates/buffer/src/lib.rs +++ b/crates/buffer/src/lib.rs @@ -2670,7 +2670,7 @@ impl<'a> Content<'a> { let mut rope_cursor = self.visible_text.cursor(0); let mut cursor = self.fragments.cursor::<(VersionedOffset, usize)>(); map.entries.iter().map(move |((offset, bias), value)| { - cursor.seek(&VersionedOffset::Offset(*offset), *bias, &cx); + cursor.seek_forward(&VersionedOffset::Offset(*offset), *bias, &cx); let overshoot = if cursor.item().map_or(false, |fragment| fragment.visible) { offset - cursor.start().0.offset() } else { @@ -2695,7 +2695,7 @@ impl<'a> Content<'a> { end: (end_offset, end_bias), } = range; - cursor.seek(&VersionedOffset::Offset(*start_offset), *start_bias, &cx); + cursor.seek_forward(&VersionedOffset::Offset(*start_offset), *start_bias, &cx); let overshoot = if cursor.item().map_or(false, |fragment| fragment.visible) { start_offset - cursor.start().0.offset() } else { @@ -2704,7 +2704,7 @@ impl<'a> Content<'a> { summary += rope_cursor.summary(cursor.start().1 + overshoot); let start_summary = summary.clone(); - cursor.seek(&VersionedOffset::Offset(*end_offset), *end_bias, &cx); + cursor.seek_forward(&VersionedOffset::Offset(*end_offset), *end_bias, &cx); let overshoot = if cursor.item().map_or(false, |fragment| fragment.visible) { end_offset - cursor.start().0.offset() } else {