Skip to main content

wrap_line_to_width

Function wrap_line_to_width 

Source
pub fn wrap_line_to_width(line: &str, max_cols: usize) -> Vec<String>
Expand description

Split a line (possibly containing SGR escape sequences) into chunks whose visible display width is at most max_cols. SGR bytes pass through without consuming display columns. Handles CJK/emoji width.

This is the renderer-side replacement for terminal autowrap: we cannot trust the terminal to wrap consistently at scroll-region boundaries, so we wrap ourselves before emitting.