[−][src]Function syntect::util::modify_range
pub fn modify_range<'a>(
v: &[(Style, &'a str)],
r: Range<usize>,
modifier: StyleModifier
) -> Vec<(Style, &'a str)>
Modify part of a highlighted line using a style modifier, useful for highlighting sections of a line.
Examples
use syntect::util::modify_range; use syntect::highlighting::{Style, StyleModifier, FontStyle}; let plain = Style::default(); let boldmod = StyleModifier { foreground: None, background: None, font_style: Some(FontStyle::BOLD) }; let bold = plain.apply(boldmod); let l = &[(plain, "abc"), (plain, "def"), (plain, "ghi")]; let l2 = modify_range(l, 1..6, boldmod); assert_eq!(l2, &[(plain, "a"), (bold, "bc"), (bold, "def"), (plain, "ghi")]);