indicate conflicting row number in error

This commit is contained in:
PgBiel 2025-02-20 02:27:56 -03:00
parent 9cfc5706bf
commit b950aa579c
3 changed files with 12 additions and 11 deletions

View File

@ -1051,7 +1051,8 @@ impl<'a> CellGrid<'a> {
if new_child_start < first_available_row { if new_child_start < first_available_row {
bail!( bail!(
cell_span, 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" 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) { if new_y < child_start.min(new_child_end) {
bail!( bail!(
cell_span, 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" hint: "try moving its cells to later rows"
); );
} else { } else {
bail!( bail!(
cell_span, 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" hint: "try moving its cells to earlier rows"
); );
} }

View File

@ -427,7 +427,7 @@
table.footer( table.footer(
table.hline(stroke: red), table.hline(stroke: red),
table.hline(y: 1, stroke: aqua), 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 // Hint: 5-24 try moving its cells to later rows
table.cell(y: 0)[b], table.cell(y: 0)[b],
[c] [c]
@ -444,7 +444,7 @@
table.footer( table.footer(
[b], [c], [b], [c],
// TODO: Why is the span just the letter 'd'? // 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 // Hint: 6-7 try moving its cells to earlier rows
[d], [d],
), ),
@ -459,7 +459,7 @@
table.cell(y: 2)[a], table.cell(y: 2)[a],
table.footer( table.footer(
[b], [c], [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 // Hint: 5-24 try moving its cells to earlier rows
table.cell(y: 3)[d], table.cell(y: 3)[d],
), ),
@ -470,7 +470,7 @@
columns: 2, columns: 2,
table.header(), table.header(),
table.footer( 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 // Hint: 5-24 try moving its cells to later rows
table.cell(y: 0)[a] table.cell(y: 0)[a]
), ),

View File

@ -390,7 +390,7 @@
table.header( table.header(
table.hline(stroke: red), table.hline(stroke: red),
table.hline(y: 1, stroke: aqua), 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 // Hint: 5-24 try moving its cells to later rows
table.cell(y: 0)[b], table.cell(y: 0)[b],
[c] [c]
@ -410,7 +410,7 @@
table.header( table.header(
table.hline(stroke: red), table.hline(stroke: red),
table.hline(y: 3, stroke: aqua), 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 // Hint: 5-24 try moving its cells to later rows
table.cell(y: 2)[b], table.cell(y: 2)[b],
) )
@ -426,7 +426,7 @@
table.header( table.header(
[b], [c], [b], [c],
// TODO: A bit odd that this span is just the letter 'd' // 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 // Hint: 6-7 try moving its cells to earlier rows
[d], [d],
), ),
@ -441,7 +441,7 @@
table.cell(y: 2)[a], table.cell(y: 2)[a],
table.header( table.header(
[b], [c], [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 // Hint: 5-24 try moving its cells to earlier rows
table.cell(y: 3)[d], table.cell(y: 3)[d],
), ),