mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
BigString sometimes miscounted distances in its character view due to alignment issues. Resolve this by overhauling distance calculations in the character metric: - Introduce a `prefixSize` function in `_StringMetric`, distinct from `distance`. - In the metric-agnostic index distance algorithm, use `prefixCount` to avoid double-counting characters that cross (or end on) chunk boundaries. - Simplify `_StringMetric.distance` by requiring that `start <= end`. - Crucially, change character-index operations to start by rounding each input index down to the nearest character break.