Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix picker preview for matches far down in files (#59621)
Anthony Eid3df8983debfa
diff --git a/crates/picker/src/preview.rs b/crates/picker/src/preview.rsindex a39818ac1a2..cdfd0957f13 100644--- a/crates/picker/src/preview.rs+++ b/crates/picker/src/preview.rs@@ -253,7 +253,8 @@ impl EditorPreview {const MIN_LINE_HEIGHT_PX: Pixels = px(6.0);const MARGIN: u32 = 2; // scrolling can offset things;- let max_rows = (window.viewport_size().height / MIN_LINE_HEIGHT_PX).ceil() as u32 + MARGIN;+ let max_visible_rows =+ (window.viewport_size().height / MIN_LINE_HEIGHT_PX).ceil() as u32 + MARGIN;self.preview_editor.update(cx, |editor, cx| {let focus_row = highlight@@ -264,8 +265,7 @@ impl EditorPreview {.to_point(&buffer.read(cx).text_snapshot()).row})- .unwrap_or_default()- .min(max_rows);+ .unwrap_or_default();let multi_buffer = editor.buffer().clone();multi_buffer.update(cx, |multi_buffer, cx| {@@ -273,7 +273,7 @@ impl EditorPreview {multi_buffer.set_excerpts_for_buffer(buffer,[Point::new(focus_row, 0)..Point::new(focus_row, 0)],- max_rows,+ max_visible_rows,cx,);});