Use styled chunks of text instead of plain strings

This commit is contained in:
Joscha 2022-07-04 10:55:25 +02:00
parent 761519c1a7
commit 9b0d80873f
8 changed files with 209 additions and 66 deletions

View file

@ -75,21 +75,3 @@ pub fn wrap(text: &str, width: usize, widthdb: &mut WidthDB) -> Vec<usize> {
breaks
}
pub fn split_at_indices<'a>(s: &'a str, indices: &[usize]) -> Vec<&'a str> {
let mut slices = vec![];
let mut rest = s;
let mut offset = 0;
for i in indices {
let (left, right) = rest.split_at(i - offset);
slices.push(left);
rest = right;
offset = *i;
}
slices.push(rest);
slices
}