Correct fit() for fill() (#16899)

* add test for #16897

this test fails at this commit.
snapshots are taken at e3b8a16c7f

* Fix #16897

* add changelog

* omit redundant test case
This commit is contained in:
Seiya authored and GitHub committed 2024-12-01 19:00:35 +09:00
1 parent 10db357c5f
commit e13614ffd8
4 files changed
+90 -1

No files matched your search

+2 -1
View File
@@ -234,7 +234,8 @@ function fits(
case DOC_TYPE_ARRAY:
case DOC_TYPE_FILL: {
const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
for (let i = parts.length - 1; i >= 0; i--) {
const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
for (let i = parts.length - 1; i >= end; i--) {
cmds.push({ mode, doc: parts[i] });
}
break;