fix: banded rows start on the first body row
The stripe began one row late: regionsAt counted the second body row as the first band. Probed on a five-row fixture with a red band1Horz — LibreOffice shades row 0 where the style paints no header region, and the row under the header where it does. The corpus cannot see this (no fixture uses the editor's own registry), so it stayed at 739; checked by eye and by the unit test's inverted expectations. A document with a table style assigned re-bands on its next open.
This commit is contained in:
1 parent
b6a8db8584
commit
04d1fed5f0
4 files changed
+29
-24
No files matched your search
@@ -195,7 +195,8 @@ export type ResolvedTableCell = {
|
||||
};
|
||||
|
||||
// The conditional regions a grid position belongs to, in ascending precedence. Banding
|
||||
// counts body rows only, so a header row doesn't shift the stripes (as in Word).
|
||||
// counts body rows only, so a header row doesn't shift the stripes, and the **first**
|
||||
// body row is the first stripe — both probed against LibreOffice.
|
||||
function regionsAt(
|
||||
style: TableStyle, look: TableLook,
|
||||
row: number, col: number, rows: number, cols: number,
|
||||
@@ -206,8 +207,8 @@ function regionsAt(
|
||||
const bodyRow = row - (on('headerRow') ? 1 : 0);
|
||||
const bodyCol = col - (on('firstColumn') ? 1 : 0);
|
||||
const matches: Record<TableRegion, boolean> = {
|
||||
bandedColumn: bodyCol >= 0 && bodyCol % 2 === 1,
|
||||
bandedRow: bodyRow >= 0 && bodyRow % 2 === 1,
|
||||
bandedColumn: bodyCol >= 0 && bodyCol % 2 === 0,
|
||||
bandedRow: bodyRow >= 0 && bodyRow % 2 === 0,
|
||||
lastColumn: col === cols - 1,
|
||||
firstColumn: col === 0,
|
||||
lastRow: row === rows - 1,
|
||||
|
||||
Reference in new issue
Block a user