1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

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 lucasmerlin
parent 052959d7a3
commit d0bfc616cf

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
},
]
}