Fixes ZED-1XW Release Notes: - N/A *or* Added/Fixed/Improved ...
Unified · Split
| @@ -581,7 +581,7 @@ pub struct HighlightedText { · 580 unmodified lines | ||
| 581 | 581 | #[derive(Default, Debug)] |
| 582 | 582 | struct HighlightedTextBuilder { |
| 583 | 583 | pub text: String, |
| 584 | − pub highlights: Vec<(Range<usize>, HighlightStyle)>, | |
| 584 | + highlights: Vec<(Range<usize>, HighlightStyle)>, | |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | impl HighlightedText { |
| @@ -624,10 +624,11 @@ impl HighlightedText { · 36 unmodified lines | ||
| 624 | 624 | let preview_highlights = self |
| 625 | 625 | .highlights |
| 626 | 626 | .into_iter() |
| 627 | + .skip_while(|(range, _)| range.end <= preview_start_ix) | |
| 627 | 628 | .take_while(|(range, _)| range.start < newline_ix) |
| 628 | 629 | .filter_map(|(mut range, highlight)| { |
| 629 | 630 | range.start = range.start.saturating_sub(preview_start_ix); |
| 630 | − range.end = range.end.saturating_sub(preview_start_ix).min(newline_ix); | |
| 631 | + range.end = range.end.min(newline_ix).saturating_sub(preview_start_ix); | |
| 631 | 632 | if range.is_empty() { |
| 632 | 633 | None |
| 633 | 634 | } else { |