You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2
~~> thisrun.String() "ع "
1
~~> thisrun.String() "a (b)"
Brackets are not ordered correctly, but in the expected output it is correct.
A fix would be to change line 119 in bidi.go to p.pairValues = append(p.pairValues, props.reverseBracket(r))
The reason is that for bracket matching, the algorithm expects the same values for open brackets and for close brackets. Without the reverseBracket, the codes for open and close brackets differ and never match. The reverseBracket function changes the codes for closing brackets to opening brackets, for example ) = U+0029 to ( U+0028.
The tests in core_test.go don't fail, because the code from the default initialisation is bypassed with:
Go version
go version go1.24.0 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
What did you expect to see?
Brackets are not ordered correctly, but in the expected output it is correct.
A fix would be to change line 119 in
bidi.go
top.pairValues = append(p.pairValues, props.reverseBracket(r))
The reason is that for bracket matching, the algorithm expects the same values for open brackets and for close brackets. Without the
reverseBracket
, the codes for open and close brackets differ and never match. ThereverseBracket
function changes the codes for closing brackets to opening brackets, for example)
= U+0029 to(
U+0028.The tests in core_test.go don't fail, because the code from the default initialisation is bypassed with:
which is IMO a bit more clear than the
if
..elseif
..else
part from theprepareInput
which is called from the user API.The text was updated successfully, but these errors were encountered: