Skip to main content

visual_offset_for_char_col

Function visual_offset_for_char_col 

Source
pub fn visual_offset_for_char_col(
    line: &str,
    seg_start: usize,
    char_col: usize,
) -> usize
Expand description

Forward companion to char_col_for_visual_offset: map a char column (within a segment starting at seg_start) to its visual x offset, in cells counted from the segment’s OWN left edge — the exact inverse relationship, using the same per-char width formula. char_col should be >= seg_start (typically chosen via segment_for_col first); a char_col before seg_start is treated as seg_start (offset 0).