Fix edge cases in charRangeToCharSpan

This fixes #8.