diff --git a/crates/typst-library/src/layout/grid/resolve.rs b/crates/typst-library/src/layout/grid/resolve.rs index 120f60d9b..5d9c788eb 100644 --- a/crates/typst-library/src/layout/grid/resolve.rs +++ b/crates/typst-library/src/layout/grid/resolve.rs @@ -1051,7 +1051,8 @@ impl<'a> CellGrid<'a> { if new_child_start < first_available_row { bail!( cell_span, - "cell would cause header or footer to expand to a non-empty row"; + "cell would cause header or footer to expand to non-empty row {}", + first_available_row.saturating_sub(1); hint: "try moving its cells to later rows" ); } @@ -1106,13 +1107,13 @@ impl<'a> CellGrid<'a> { if new_y < child_start.min(new_child_end) { bail!( cell_span, - "cell would cause header or footer to expand to a non-empty row"; + "cell would cause header or footer to expand to non-empty row {new_y}"; hint: "try moving its cells to later rows" ); } else { bail!( cell_span, - "cell would cause header or footer to expand to a non-empty row"; + "cell would cause header or footer to expand to non-empty row {new_y}"; hint: "try moving its cells to earlier rows" ); } diff --git a/tests/suite/layout/grid/footers.typ b/tests/suite/layout/grid/footers.typ index ffe105228..2d4ce31b9 100644 --- a/tests/suite/layout/grid/footers.typ +++ b/tests/suite/layout/grid/footers.typ @@ -427,7 +427,7 @@ table.footer( table.hline(stroke: red), table.hline(y: 1, stroke: aqua), - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 0 // Hint: 5-24 try moving its cells to later rows table.cell(y: 0)[b], [c] @@ -444,7 +444,7 @@ table.footer( [b], [c], // TODO: Why is the span just the letter 'd'? - // Error: 6-7 cell would cause header or footer to expand to a non-empty row + // Error: 6-7 cell would cause header or footer to expand to non-empty row 1 // Hint: 6-7 try moving its cells to earlier rows [d], ), @@ -459,7 +459,7 @@ table.cell(y: 2)[a], table.footer( [b], [c], - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 2 // Hint: 5-24 try moving its cells to earlier rows table.cell(y: 3)[d], ), @@ -470,7 +470,7 @@ columns: 2, table.header(), table.footer( - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 0 // Hint: 5-24 try moving its cells to later rows table.cell(y: 0)[a] ), diff --git a/tests/suite/layout/grid/headers.typ b/tests/suite/layout/grid/headers.typ index 349077754..eb329cb71 100644 --- a/tests/suite/layout/grid/headers.typ +++ b/tests/suite/layout/grid/headers.typ @@ -390,7 +390,7 @@ table.header( table.hline(stroke: red), table.hline(y: 1, stroke: aqua), - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 0 // Hint: 5-24 try moving its cells to later rows table.cell(y: 0)[b], [c] @@ -410,7 +410,7 @@ table.header( table.hline(stroke: red), table.hline(y: 3, stroke: aqua), - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 2 // Hint: 5-24 try moving its cells to later rows table.cell(y: 2)[b], ) @@ -426,7 +426,7 @@ table.header( [b], [c], // TODO: A bit odd that this span is just the letter 'd' - // Error: 6-7 cell would cause header or footer to expand to a non-empty row + // Error: 6-7 cell would cause header or footer to expand to non-empty row 1 // Hint: 6-7 try moving its cells to earlier rows [d], ), @@ -441,7 +441,7 @@ table.cell(y: 2)[a], table.header( [b], [c], - // Error: 5-24 cell would cause header or footer to expand to a non-empty row + // Error: 5-24 cell would cause header or footer to expand to non-empty row 2 // Hint: 5-24 try moving its cells to earlier rows table.cell(y: 3)[d], ),