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 {
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"
);
}

View File

@ -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]
),

View File

@ -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],
),