INNER CODE UNIT · Rust

r

sachaos/viddy · src/bytes.rs:23

            let r = TAB_SIZE - (width % TAB_SIZE);
            b.resize(b.len() + r, ' ');
            width += r;
        } else if c == '\n' {
            b.push('\n');
            width = 0;
        } else {
            b.push(c);
            width += c.width().unwrap_or(1);
        }
    }
    b.into_iter().collect::<String>().into_bytes()
}

// Based on https://github.com/mgeisler/textwrap/blob/63970361d1d653ec8715acb931c3c109750d4a57/src/core.rs
/// The CSI or “Control Sequence Introducer” introduces an ANSI escape
/// sequence. This is typically used for colored text and will be
/// ignored when computing the text width.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…