Skip to main content

clip_to_width

Function clip_to_width 

Source
pub fn clip_to_width(line: &str, cols: Option<usize>) -> String
Expand description

Keep a frame line from auto-wrapping: count visible columns ignoring SGR escapes and control chars, and drop trailing visible chars that would push past cols. Appends a reset so a truncated color run can’t leak.