Skip to main content

collapse

Function collapse 

Source
pub fn collapse(line: &str, cell_col: u32, tab_size: u32, bias: Bias) -> u32
Expand description

Cell column → byte column, with the mid-tab bias snap.

A cell landing strictly inside a tab is not a valid caret slot: Bias::Left yields the byte of the \t, Bias::Right the byte just after it. Only a tab has width > 1, so only a tab can trigger the snap. A cell_col past end-of-line clamps to the line’s byte length. The result is always a UTF-8 char boundary.