editor: Fix panic in `refresh_inline_values` when spanning cross excerpts (#51685) (cherry-pick to preview) (#51686)

zed-zippy[bot] and Lukas Wirth created

Cherry-pick of #51685 to preview

----
Fixes ZED-5VQ

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored-by: Lukas Wirth <lukas@zed.dev>

Change summary

crates/editor/src/editor.rs | 8 ++++++++
1 file changed, 8 insertions(+)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -24067,6 +24067,14 @@ impl Editor {
                         editor.buffer.read(cx).buffer(excerpt.buffer_id())
                     })?;
 
+                    if current_execution_position
+                        .text_anchor
+                        .buffer_id
+                        .is_some_and(|id| id != buffer.read(cx).remote_id())
+                    {
+                        return Some(Task::ready(Ok(Vec::new())));
+                    }
+
                     let range =
                         buffer.read(cx).anchor_before(0)..current_execution_position.text_anchor;