Repository navigation
Conversation
The fast path checks the levels before rule L1. In an RTL paragraph, L1 resets segment separators and trailing whitespace to level 1, so a line with no odd level can still need reordering, and it came back in logical order. In an LTR paragraph L1 only resets to level 0, so the fast path stays correct there.
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.
reorder_linereturns the line unchanged when!level::has_rtl(&self.levels[line])(src/lib.rs:595,:828;src/utf16.rs:272,:505). Those are the levels before rule L1. In an RTL paragraph, L1 resets segment separators and trailing whitespace to the paragraph level (1), so a line of LTR text can still need reordering:"a\tb"0..3"a\tb""b\ta""a b"0..2"a "" a"BidiTest.txthas the same cases (L S L; 4→@Reorder: 2 1 0,L WS; 4→@Reorder: 1 0); the conformance tests checkreordered_levels/reorder_visual, notreorder_line, so they don't hit this path.This keeps the fast path, but only for LTR paragraphs, where L1 resets to level 0 and cannot create an odd level. The fast path came in with 181cd1d; the shortcut before it looked at the post-L1 levels.
The new rows at the end of
test_reorder_linecheck all fourreorder_lineimplementations and fail on main.cargo test(also--features serde,--no-default-features,--no-default-features --features=hardcoded-data),cargo fmt --check, andcargo teston 1.47.0 pass.Written with AI assistance (Claude); I have reviewed the change.