Pin colspan and rowspan for blank cells (#6401)

This commit is contained in:
PgBiel 2025-06-09 10:46:29 -03:00 committed by GitHub
parent 494e6a6422
commit 6725061841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 2 deletions

View File

@ -755,7 +755,14 @@ impl Show for Packed<GridCell> {
impl Default for Packed<GridCell> {
fn default() -> Self {
Packed::new(GridCell::new(Content::default()))
Packed::new(
// Explicitly set colspan and rowspan to ensure they won't be
// overridden by set rules (default cells are created after
// colspans and rowspans are processed in the resolver)
GridCell::new(Content::default())
.with_colspan(NonZeroUsize::ONE)
.with_rowspan(NonZeroUsize::ONE),
)
}
}

View File

@ -770,7 +770,14 @@ impl Show for Packed<TableCell> {
impl Default for Packed<TableCell> {
fn default() -> Self {
Packed::new(TableCell::new(Content::default()))
Packed::new(
// Explicitly set colspan and rowspan to ensure they won't be
// overridden by set rules (default cells are created after
// colspans and rowspans are processed in the resolver)
TableCell::new(Content::default())
.with_colspan(NonZeroUsize::ONE)
.with_rowspan(NonZeroUsize::ONE),
)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

View File

@ -140,3 +140,7 @@
[e], [g], grid.cell(colspan: 2)[eee\ e\ e\ e],
grid.cell(colspan: 4)[eeee e e e]
)
--- issue-6399-grid-cell-colspan-set-rule ---
#set grid.cell(colspan: 2)
#grid(columns: 3, [hehe])

View File

@ -488,3 +488,7 @@
table.cell(rowspan: 15, align: horizon, lets-repeat((rotate(-90deg, reflow: true)[*All Tests*]), 3)),
..([123], [456], [789]) * 15
)
--- issue-6399-grid-cell-rowspan-set-rule ---
#set grid.cell(rowspan: 2)
#grid(columns: 2, [hehe])