Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add upper bound limit. Remove dbg! statements
Piotr Osiewicz42e12213571d
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex c12bdc9c55c..682974d61fb 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -7553,6 +7553,7 @@ impl Editor {&self,search_range: Range<Anchor>,display_snapshot: &DisplaySnapshot,+ count: usize,theme: &Theme,) -> Vec<RangeInclusive<u32>> {let mut results = Vec::new();@@ -7572,6 +7573,7 @@ impl Editor {}) {Ok(i) | Err(i) => i,};+ let end_ix = count.min(ranges.len());let mut push_region = |start, end| {if let (Some(start_display), Some(end_display)) = (start, end) {results.push(start_display..=end_display);@@ -7579,7 +7581,7 @@ impl Editor {};let mut start_row = None;let mut end_row = None;- for range in &ranges[start_ix..] {+ for range in &ranges[start_ix..end_ix] {if range.start.cmp(&search_range.end, buffer).is_ge() {break;}diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 9ef95ec929a..735abbbd13f 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -1132,15 +1132,13 @@ impl EditorElement {corner_radius: style.thumb.corner_radius,})};- let start = std::time::Instant::now();-let background_ranges = editor.selected_rows::<crate::items::BufferSearchHighlights>(start_anchor..end_anchor,&layout.position_map.snapshot,+ 50000,&theme,);- dbg!(start.elapsed().as_millis());for row in background_ranges {let start = row.start();let end = row.end();