pub struct HighlightCursor<'a> { /* private fields */ }Expand description
Highlight::covering for a caller walking the document in order — which
is every painter, since a frontend draws rows top to bottom and glyphs left
to right.
The one-shot form is a scan from the front of the list per glyph, and a
document with two hundred search hits pays that two hundred times a row. A
range that ends at or before an offset can never cover that offset or any
later one, so the cursor retires those permanently and each glyph costs the
ranges that actually reach it. The answer is identical to
Highlight::covering’s, offset for offset — this is the same scan with
the part that was being redone dropped, not a cheaper approximation.
Offsets are expected to arrive non-decreasing. One that goes backwards is still answered correctly: the cursor re-seats to the front, since a painter that revisits a row is asking a question the retired ranges may own again.