Fix anchor_in_excerpt on replaced excerpts (cherry-pick #28880) (#28892)

gcp-cherry-pick-bot[bot] and Conrad Irwin created

Cherry-picked Fix anchor_in_excerpt on replaced excerpts (#28880)

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>

Change summary

crates/multi_buffer/src/multi_buffer.rs | 1 +
1 file changed, 1 insertion(+)

Detailed changes

crates/multi_buffer/src/multi_buffer.rs 🔗

@@ -5170,6 +5170,7 @@ impl MultiBufferSnapshot {
         excerpt_id: ExcerptId,
         text_anchor: text::Anchor,
     ) -> Option<Anchor> {
+        let excerpt_id = self.latest_excerpt_id(excerpt_id);
         let locator = self.excerpt_locator_for_id(excerpt_id);
         let mut cursor = self.excerpts.cursor::<Option<&Locator>>(&());
         cursor.seek(locator, Bias::Left, &());