Harden highlighter against alias spans (#867)

This commit is contained in:
JT 2022-01-28 07:29:45 -05:00 committed by GitHub
parent fd9e380a1e
commit e11ac9f6f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,10 @@ impl Highlighter for NuHighlighter {
let mut last_seen_span = global_span_offset;
for shape in &shapes {
if shape.0.end <= last_seen_span {
if shape.0.end <= last_seen_span
|| last_seen_span < global_span_offset
|| shape.0.start < global_span_offset
{
// We've already output something for this span
// so just skip this one
continue;