INNER CODE UNIT · Rust
b
sachaos/viddy · src/bytes.rs:9
let mut b = Vec::with_capacity(str.len() * TAB_SIZE);
let mut chars = str.chars();
let mut width = 0;
while let Some(c) = chars.next() {
let count = skip_ansi_escape_sequence(c, &mut chars.clone());
if count > 0 {
b.push(c);
for _ in 0..count {
b.push(chars.next().unwrap_or(' '));
}
continue;
}
if c == '\t' {
let r = TAB_SIZE - (width % TAB_SIZE);
b.resize(b.len() + r, ' ');
width += r;
} else if c == '\n' {