Skip to main content

LineHighlighter

Type Alias LineHighlighter 

Source
pub type LineHighlighter = dyn Fn(&str) -> Vec<(usize, usize, Color)>;
Expand description

Signature of a per-visual-line syntax highlighter. Given one wrapped line’s rendered text, it returns a list of (start_byte, end_byte, color) runs (byte offsets relative to that line). Bytes not covered by any run are drawn in the ambient text colour. Runs are expected to be non-overlapping and sorted; overlaps simply repaint. Keeping it line-oriented sidesteps span-across-wrap bookkeeping and matches the simple fallback highlighter in egui’s Code Editor demo.