ensure highlight scopes are skipped properly

pull/6417/head
Pascal Kuthe 1 year ago
parent 22dfad605a
commit 2023445a08
No known key found for this signature in database
GPG Key ID: D715E8655AE166A6

@ -68,10 +68,7 @@ impl<H: Iterator<Item = HighlightEvent>> Iterator for StyleIter<'_, H> {
HighlightEvent::HighlightEnd => { HighlightEvent::HighlightEnd => {
self.active_highlights.pop(); self.active_highlights.pop();
} }
HighlightEvent::Source { start, mut end } => { HighlightEvent::Source { mut end, .. } => {
if start == end {
continue;
}
let style = self let style = self
.active_highlights .active_highlights
.iter() .iter()
@ -300,12 +297,12 @@ pub fn render_text<'t>(
} }
// acquire the correct grapheme style // acquire the correct grapheme style
if char_pos >= syntax_style_span.1 { while char_pos >= syntax_style_span.1 {
syntax_style_span = syntax_styles syntax_style_span = syntax_styles
.next() .next()
.unwrap_or((Style::default(), usize::MAX)); .unwrap_or((Style::default(), usize::MAX));
} }
if char_pos >= overlay_style_span.1 { while char_pos >= overlay_style_span.1 {
overlay_style_span = overlay_styles overlay_style_span = overlay_styles
.next() .next()
.unwrap_or((Style::default(), usize::MAX)); .unwrap_or((Style::default(), usize::MAX));

Loading…
Cancel
Save