Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR adds a new iterator:
UnicodeWordIndices
(and the functionunicode_word_indices
). It is similar toUnicodeWords
but also provides byte offsets for each word.The motivation for this PR was making nushell/reedline#5 in which I used
split_word_bound_indices
and then filtered the result using logic that is internal tounicode_words
. I believe that PR would have been trivial usingunicode_word_indices
. Hopefully it can also be useful to others.Should I add more tests for
unicode_word_indices
? Or are the existing tests forunicode_words
and the doc test forunicode_word_indices
sufficient?