FindMyFiles

FindMyFiles.Highlighting

HighlightSegmenter Class

Splits a string into consecutive highlighted/plain segments from a set of merged ranges — the pure, unit-tested core of the highlight renderer, kept free of WinUI so it runs headless. Ranges are clamped to the string, so a stale or out-of-bounds range can never throw.

public static class HighlightSegmenter

Inheritance System.Object → HighlightSegmenter

Methods

HighlightSegmenter.Split(string, IReadOnlyList<HighlightRange>) Method

Cut text at the boundaries of ranges (assumed sorted and non-overlapping — as produced by Ranges(string, HighlightField)), tagging each piece as highlighted or not. Empty ranges yield the whole string as one plain segment; zero-length or out-of-range entries are skipped/clamped.

public static System.Collections.Generic.List<FindMyFiles.Highlighting.HighlightSegment> Split(string text, System.Collections.Generic.IReadOnlyList<FindMyFiles.Highlighting.HighlightRange> ranges);

Parameters

text System.String

The full string being rendered.

ranges System.Collections.Generic.IReadOnlyList<HighlightRange>

The spans to emphasize.

Returns

System.Collections.Generic.List<HighlightSegment>
The string split into consecutive plain and highlighted pieces, in order.