servo / unicode-bidi

Implementation of the Unicode Bidirection Algorithm in Rust
Other
78 stars 33 forks source link

Provide get_base_direction_full API to consider the whole text #121

Closed jfkthame closed 9 months ago

jfkthame commented 9 months ago

The get_base_direction function (from #117) considers only the first paragraph of the given text; but if this has no strong characters, some callers may want to consider subsequent paragraphs as well rather than just return Mixed.

This is trivial to implement by simply resetting the isolate count when encountering a block separator, instead of returning at that point.

(It might've been better to expose a first_paragraph_only boolean parameter to the original get_base_direction, but I presume we don't want to modify public API, hence the separate ...full version of the function, sharing the internal implementation.