3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 22:25:44 +01:00

Answer stability round 1: 0 🔴, 3 🟡 (0 misread); state item 190 for every run crossing a hard break, name trimmingRuns in the decision, say the run reaches between its non-blank holders

This commit is contained in:
2026-11-15 14:38:49 +01:00
committed by Lillem4n
parent 7d1e2d96ba
commit a8a5bd4377
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -250,7 +250,7 @@ function edgeOutcome(marks: readonly AdfMark[], { lineEdge, sharedRuns }: Beside
return depth === 0 && lineEdge ? { kind: 'drop' } : { depth, kind: 'keep' }
}
// For each leaf but the last, how many of `grouping`'s runs hold it and the next leaf; an edge-stripping mark's run spans only its leaves holding more than spaces and tabs, as the trim strips the mark off blank leaves past them, else one pass each.
// For each leaf but the last, how many of `grouping`'s runs hold it and the next leaf; an edge-stripping mark's run reaches only from its first to its last non-blank holder, since the trim strips the mark off the blank holders outside, one pass each if they counted.
export function trimmingRuns(leaves: readonly AdfNode[], grouping: RunGrouping): number[] {
const shared = leaves.map(() => 0)
countTrimmingRuns(leaves.map((node) => ({ carried: false, node, outer: 0 })), 0, grouping, shared)