Skip to content

Commit d0bfc61

Browse files
HactarCEemilklucasmerlin
committed
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 <[email protected]> Co-authored-by: Lucas Meurer <[email protected]>
1 parent 052959d commit d0bfc61

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/epaint/src/text/fonts.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ impl GalleyCache {
930930
} else {
931931
// Section range overlaps with paragraph range
932932
debug_assert!(
933-
section_range.start < section_range.end,
933+
section_range.start <= section_range.end,
934934
"Bad byte_range: {section_range:?}"
935935
);
936936
let new_range = section_range.start.saturating_sub(start)
@@ -1162,6 +1162,13 @@ mod tests {
11621162

11631163
job
11641164
},
1165+
{
1166+
// Regression test for <https://github.com/emilk/egui/issues/7378>
1167+
let mut job = LayoutJob::default();
1168+
job.append("\n", 0.0, TextFormat::default());
1169+
job.append("", 0.0, TextFormat::default());
1170+
job
1171+
},
11651172
]
11661173
}
11671174

0 commit comments

Comments
 (0)