From dafcf8b11ee427d88b56fe373d5b99345ea4ec4d Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Tue, 6 May 2025 03:42:02 -0300 Subject: [PATCH] temp fix for imprecision in may_progress_with_offset better idea: check once at the start of the region if there are non-header rows, or we could progress at the start of the region, we may progress --- crates/typst-layout/src/grid/layouter.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/typst-layout/src/grid/layouter.rs b/crates/typst-layout/src/grid/layouter.rs index c3035649d..75cf16995 100644 --- a/crates/typst-layout/src/grid/layouter.rs +++ b/crates/typst-layout/src/grid/layouter.rs @@ -1802,6 +1802,9 @@ pub(super) fn points( /// additional logic which adds content automatically on each region turn (in /// our case, headers). pub(super) fn may_progress_with_offset(regions: Regions<'_>, offset: Abs) -> bool { + // Use 'approx_eq' as float addition and subtraction are not associative. !regions.backlog.is_empty() - || regions.last.is_some_and(|height| regions.size.y + offset != height) + || regions + .last + .is_some_and(|height| !(regions.size.y + offset).approx_eq(height)) }