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:
parent
763e2df9f9
commit
1c460b6dc0
|
|
@ -930,7 +930,7 @@ impl GalleyCache {
|
||||||
} else {
|
} else {
|
||||||
// Section range overlaps with paragraph range
|
// Section range overlaps with paragraph range
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
section_range.start < section_range.end,
|
section_range.start <= section_range.end,
|
||||||
"Bad byte_range: {section_range:?}"
|
"Bad byte_range: {section_range:?}"
|
||||||
);
|
);
|
||||||
let new_range = section_range.start.saturating_sub(start)
|
let new_range = section_range.start.saturating_sub(start)
|
||||||
|
|
@ -1162,6 +1162,13 @@ mod tests {
|
||||||
|
|
||||||
job
|
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
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue