Skip to content

Possibly redundant checks by Graphemes::next #144

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

Open
s9ferech opened this issue Mar 31, 2025 · 0 comments
Open

Possibly redundant checks by Graphemes::next #144

s9ferech opened this issue Mar 31, 2025 · 0 comments

Comments

@s9ferech
Copy link

s9ferech commented Mar 31, 2025

If you make just a small change to the Graphemes::next method then this breaks the tests in graphemes_test because the GraphemeCursor::next_boundary returns GraphemeIncomplete::PreContext(1). As far as I understand, this indicates that the cursor tries to look back at preceding grapheme clusters that it has already processed. I don't know if this behavior is intentional or required to process UTF-8 correctly, but it seems unnecessary because the tests do pass if you just use a fresh cursor instead and treat your current position as the start of the string. Some performance improvements might be possible if you do it that way.

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

No branches or pull requests

1 participant