fn clamp_start(index: usize, ranges: &[Range<usize>]) -> Option<usize>
Increase the index until it is inside or one past the end of one of the ranges.
The ranges must be sorted for this to work correctly.