Fit a read-only table's rows to their cells
Some checks failed
Commit messages lint / commitlint (push) Has been cancelled

A table keeps each row's height on its cells, corrected after every
layout through a transaction. A read-only editor applies no transaction
(EditorState.apply returns while it isn't editable), so a table shown
read-only kept the heights it was stored with, or the default of one
line: a cell of several lines ran over its row's borders. The table's
own height (colsHeight) already took the read-only case in place; the
rows' heights now do the same. Upstream's main has the same code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-11 19:23:19 +02:00
commit 81c3006c74
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -83,5 +83,23 @@ void main() async {
expect(tableNode.getRowHeight(0), row0beforeHeight);
await editor.dispose();
});
testWidgets('a read-only table fits its rows to their cells', (
tester,
) async {
final tableNode = TableNode.fromList([
['one\ntwo\nthree', ''],
['', ''],
]);
final editor = tester.editor..addNode(tableNode.node);
await editor.startTesting(editable: false);
await tester.pumpAndSettle();
final cell00 = getCellNode(tableNode.node, 0, 0)!;
expect(tableNode.getRowHeight(0), cell00.children.first.rect.height + 8);
expect(tableNode.getRowHeight(0), greaterThan(tableNode.getRowHeight(1)));
await editor.dispose();
});
});
}