Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Do not query start of range if it's end is the same as the previous hunk's
Piotr Osiewiczfa168959764d
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 8f8511deb69..c12bdc9c55c 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -7557,12 +7557,11 @@ impl Editor {) -> Vec<RangeInclusive<u32>> {let mut results = Vec::new();let buffer = &display_snapshot.buffer_snapshot;- let Some((color_fetcher, ranges)) = self.background_highlights+ let Some((_, ranges)) = self.background_highlights.get(&TypeId::of::<T>()) else {return vec![];};- let color = color_fetcher(theme);let start_ix = match ranges.binary_search_by(|probe| {let cmp = probe.end.cmp(&search_range.start, buffer);if cmp.is_gt() {@@ -7584,8 +7583,14 @@ impl Editor {if range.start.cmp(&search_range.end, buffer).is_ge() {break;}- let start = range.start.to_point(buffer).row;let end = range.end.to_point(buffer).row;+ if let Some(current_row) = &end_row {+ if end == *current_row {+ continue;+ }+ }+ let start = range.start.to_point(buffer).row;+if start_row.is_none() {assert_eq!(end_row, None);start_row = Some(start);