Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Fix panic in minimap selection rendering (#49692)
Lukas Wirthd54dbe9d5f3e
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 0cdd1c80454..d76fb175c32 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -9752,11 +9752,39 @@ impl Element for EditorElement {let mut highlighted_ranges = self.editor_with_selections(cx).map(|editor| {- editor.read(cx).background_highlights_in_range(- start_anchor..end_anchor,- &snapshot.display_snapshot,- cx.theme(),- )+ if editor == self.editor {+ editor.read(cx).background_highlights_in_range(+ start_anchor..end_anchor,+ &snapshot.display_snapshot,+ cx.theme(),+ )+ } else {+ editor.update(cx, |editor, cx| {+ let snapshot = editor.snapshot(window, cx);+ let start_anchor = if start_row == Default::default() {+ Anchor::min()+ } else {+ snapshot.buffer_snapshot().anchor_before(+ DisplayPoint::new(start_row, 0)+ .to_offset(&snapshot, Bias::Left),+ )+ };+ let end_anchor = if end_row > max_row {+ Anchor::max()+ } else {+ snapshot.buffer_snapshot().anchor_before(+ DisplayPoint::new(end_row, 0)+ .to_offset(&snapshot, Bias::Right),+ )+ };++ editor.background_highlights_in_range(+ start_anchor..end_anchor,+ &snapshot.display_snapshot,+ cx.theme(),+ )+ })+ }}).unwrap_or_default();