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
|
||||
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) {
|
||||
LineBreak::Glue | LineBreak::WordJoiner | LineBreak::ZWJ => continue,
|
||||
LineBreak::MandatoryBreak
|
||||
| LineBreak::CarriageReturn
|
||||
| LineBreak::LineFeed
|
||||
| LineBreak::NextLine => true,
|
||||
_ => self.end == self.p.bidi.text.len(),
|
||||
_ => false,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user