Skip zero-length layout job sections (#7430)

Fixes #7378 

Includes a regression test that previously failed and now succeeds.

* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
This commit is contained in:
Andrew Farkas 2025-09-04 07:17:59 -04:00 committed by GitHub
parent 763e2df9f9
commit 1c460b6dc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -930,7 +930,7 @@ impl GalleyCache {
} else {
// Section range overlaps with paragraph range
debug_assert!(
section_range.start < section_range.end,
section_range.start <= section_range.end,
"Bad byte_range: {section_range:?}"
);
let new_range = section_range.start.saturating_sub(start)
@ -1162,6 +1162,13 @@ mod tests {
job
},
{
// Regression test for <https://github.com/emilk/egui/issues/7378>
let mut job = LayoutJob::default();
job.append("\n", 0.0, TextFormat::default());
job.append("", 0.0, TextFormat::default());
job
},
]
}