Skip to main content

slice_cols

Function slice_cols 

Source
pub fn slice_cols(s: &str, start_col: usize, max_cols: usize) -> String
Expand description

Slice s starting at display column start_col, taking up to max_cols columns. Characters that straddle the start boundary are skipped. Used to implement horizontal scroll in the input prompt — keeps the cursor visible when the buffer exceeds the viewport width.