Add upper bound limit. Remove dbg! statements

This commit is contained in:
Piotr Osiewicz 2023-08-08 02:17:11 +02:00
parent fa16895976
commit 42e1221357
2 changed files with 4 additions and 4 deletions

View file

@ -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;
}

View file

@ -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();