mirror of
https://github.com/typst/typst
synced 2025-05-18 11:05:28 +08:00
Fix trailing mandatory breaks being swallowed (#2502)
This commit is contained in:
parent
b80382b216
commit
1603e2df26
@ -1206,15 +1206,20 @@ impl Iterator for Breakpoints<'_> {
|
|||||||
|
|
||||||
// Fix for: https://github.com/unicode-org/icu4x/issues/4146
|
// Fix for: https://github.com/unicode-org/icu4x/issues/4146
|
||||||
if let Some(c) = self.p.bidi.text[..self.end].chars().next_back() {
|
if let Some(c) = self.p.bidi.text[..self.end].chars().next_back() {
|
||||||
|
if self.end == self.p.bidi.text.len() {
|
||||||
|
self.mandatory = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
self.mandatory = match lb.get(c) {
|
self.mandatory = match lb.get(c) {
|
||||||
LineBreak::Glue | LineBreak::WordJoiner | LineBreak::ZWJ => continue,
|
LineBreak::Glue | LineBreak::WordJoiner | LineBreak::ZWJ => continue,
|
||||||
LineBreak::MandatoryBreak
|
LineBreak::MandatoryBreak
|
||||||
| LineBreak::CarriageReturn
|
| LineBreak::CarriageReturn
|
||||||
| LineBreak::LineFeed
|
| LineBreak::LineFeed
|
||||||
| LineBreak::NextLine => true,
|
| LineBreak::NextLine => true,
|
||||||
_ => self.end == self.p.bidi.text.len(),
|
_ => false,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user