Skip to main content

expand

Function expand 

Source
pub fn expand(line: &str, byte_col: u32, tab_size: u32) -> u32
Expand description

Byte column → cell column, a per-line scan from column 0.

Each \t advances tab_width; every other Unicode scalar advances one cell (scalars, not bytes — a stray multibyte char shifts columns, never corrupts them). byte_col past the line length simply expands the whole line. O(line); at typical short lines this is single-digit µs, so no sum-tree or cursor structure is needed.