Fix GB12/GB13 when the regional indicator count is already known - #175
Merged
Conversation
Contributor
Author
|
I just noticed that the same issue was reported already in #174. This PR should fix it. |
Manishearth
approved these changes
Jul 28, 2026
Member
|
Clippy failure unrelated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A
GraphemeCursordriven forward in chunks splits a flag in two:Reproduces on 1.13.3. Both extended and legacy mode, and every chunk size.
ris_counthas two readers with incompatible expectations.next_boundarymaintains it as "the number of RIS immediately precedingoffset", which is what the field's doc comment says.handle_regionalinstead treats it as an accumulator for the backward walk it is about to perform. It seedsris_countfrom the field and then increments it for each RIS it walks over.That is correct when
handle_regionalis resuming a walk it started itself across an earlier chunk. It is wrong when the field was populated by forward iteration, because the codepoints it walks back over are the very ones already counted, so they are counted twice and an odd run reads as even.Failing test first, then the fix commit follows.