Closed laurmaedje closed 3 years ago
Thanks!
It looks like this increases the minimum Rust requirement to 1.36 because it uses non-lexical lifetimes. I think that's fine, because our main downstream crate (url
) already requires 1.36 or later. I'll merge this now, and open a separate PR to fix up the CI configuration.
Published unicode-bidi 0.3.5 with this fix.
The reset logic in visual runs doesn't take the line offset into account. The for loop iterates over the line's char indices, but the line-local index
i
is then used to index into theoriginal_classes
for the whole paragraph.Consider the string
"aa טֶ"
, which consists of five chars with the following subranges:0..1: a
1..2: a
2..3: space
3..5: ט
5..7: \u{5b6}
What happens in detail: When resolving the line
3..7
, the code previously iterated over both chars, and for the last chari=2
resolved to the original class of the space, settingreset_from
toSome(2)
. Then, all bytes from2
toline_str.len()
(which was4
), were reset to paragraph level. As a result, the first half ofט
was reset to0
.The result of all this is that the reordered visual runs now slice the
ט
in half because its level changes halfway through. In addition to a fix for the problem, I added the above example as a test case.