Stop sending " " to linebreaker for replaced content (#30740)

We previously sent a " " to the linebreaker in order to ensure that the
next text had a soft wrap opportunity at the start. Calling `next(" ")`
without waiting until the returned index was 1, violated some
invariants of linebreaker ultimately causing a panic.

Instead of using the linebreaker for this, simply keep a flag in the
IFC layout state, which avoids the problem entirely.

Fixes #30703.
This commit is contained in:
Martin Robinson 2023-11-30 15:46:14 +01:00 committed by GitHub
parent 53b0fa827d
commit f1c291853e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 13 deletions

View file

@ -220,7 +220,7 @@ impl<'a> TextRun {
if text.len() == 0 {
return (glyphs, true);
}
*breaker = Some(LineBreakLeafIter::new(&text, 0));
*breaker = Some(LineBreakLeafIter::new(text, 0));
}
let breaker = breaker.as_mut().unwrap();