pub fn split_at<'a, A: Clone>(
v: &[(A, &'a str)],
split_i: usize
) -> (Vec<(A, &'a str)>, Vec<(A, &'a str)>)
Expand description
Split a highlighted line at a byte index in the line into a before and after component.
This is just a helper that does the somewhat tricky logic including splitting a span if the index lies on a boundary.
This can be used to extract a chunk of the line out for special treatment like wrapping it in an HTML tag for extra styling.
Generic for testing purposes and fancier use cases, but intended for use with
the Vec<(Style, &str)>
returned by highlight
methods. Look at the source
code for modify_range
for an example usage.