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
Since 0cfd9b6, Buffer::set_text() uses the new LineIter to break the input text into paragraphs while Buffer::set_rich_text() relies on BidiParagraphs. This has some surprising repercussions since the two iterators behave slightly different.
For example, BidiParagraphs breaks at the U+2029 paragraph separator while LineIter does not. ShapeLine::new_in_buffer() joins paragraphs based on BidiInfo, but expects them to have matching directions. As a result, two paragraphs with different directions separated by U+2029 will cause a panic through Buffer::set_text(), but not through Buffer::set_rich_text():
// Paragraphs are separated early by `BidiParagraphs` -> no panic in `ShapeLine::new_in_buffer()`
buffer.set_rich_text([("Reuven Rivlin\u{2029}ראובן ריבלין", attrs)], attrs,Shaping::Advanced);// Paragraphs stick together through `LineIter` -> panic in `ShapeLine::new_in_buffer()`
buffer.set_text("Reuven Rivlin\u{2029}ראובן ריבלין", attrs,Shaping::Advanced);
The text was updated successfully, but these errors were encountered:
Since 0cfd9b6,
Buffer::set_text()
uses the newLineIter
to break the input text into paragraphs whileBuffer::set_rich_text()
relies onBidiParagraphs
. This has some surprising repercussions since the two iterators behave slightly different.For example,
BidiParagraphs
breaks at theU+2029
paragraph separator whileLineIter
does not.ShapeLine::new_in_buffer()
joins paragraphs based onBidiInfo
, but expects them to have matching directions. As a result, two paragraphs with different directions separated byU+2029
will cause a panic throughBuffer::set_text()
, but not throughBuffer::set_rich_text()
:The text was updated successfully, but these errors were encountered: