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