pub fn position_to_char(rope: &Rope, pos: Position) -> usize
Converts a position to a char offset, clamping line and column into the document.