3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Answer prose round 1: 0 🔴, 2 🟡 (0 misread); say what insideRun's callers rely on, delete sharedRuns's comment, clear the termination comment

This commit is contained in:
2026-11-03 21:54:29 +01:00
committed by Lillem4n
parent bcdf224e4c
commit 1409a1699a
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -162,7 +162,7 @@ function withMarks(leaf: AdfNode, marks: readonly AdfMark[]): AdfNode {
}
export function trimmedEdges(leaves: readonly AdfNode[]): AdfNode[] {
// Terminates: a pass that changes a leaf drops its edge whitespace or takes a mark off that whitespace, and merging adds neither.
// Terminates: a pass that changes a leaf drops whitespace from the leaf's edge or takes a mark off that whitespace, and merging adds no whitespace or mark.
for (let current = leaves; ; ) {
const merged = withoutEdgeBreaks(mergeAdjacentText(current, joinsWhenEditorNormal))
let changed = false
@@ -218,7 +218,6 @@ function edgeDepth(marks: readonly AdfMark[], neighbour: AdfNode | undefined, wh
return kept === 0 && lineEdge ? undefined : kept
}
// How many of the runs around a leaf holding `marks`, outermost first, hold `neighbour` too.
function sharedRuns(marks: readonly AdfMark[], neighbour: AdfNode): number {
let inside: RunNode | undefined = { node: neighbour, outer: 0 }
for (const [depth, mark] of marks.entries()) {