Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect non breaking spaces #41

Merged
merged 2 commits into from
May 4, 2017
Merged

Respect non breaking spaces #41

merged 2 commits into from
May 4, 2017

Conversation

mgeisler
Copy link
Owner

@mgeisler mgeisler commented May 4, 2017

Non-breaking spaces are (obviously) treated as whitespace characters
by the String::split_whitespace method, which meant that we would
happily break words on such spaces. We now use String::split instead
with our own predicate.

Fixes #39.

Non-breaking spaces are (obviously) treated as whitespace characters
by the String::split_whitespace method, which meant that we would
happily break words on such spaces. We now use String::split instead
with our own predicate.

Somewhat surprisingly, using String::split is about 15-20% faster than
using String::split_whitespace, so we even get a performance boost out
of this new code.

Fixes #39.
There is such a thing as a non-breaking hyphen. We did not break words
on those and this new test helps to verify this in the future.
@mgeisler mgeisler merged commit ae17a02 into master May 4, 2017
@mgeisler mgeisler deleted the non-breaking-space branch September 24, 2017 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant