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

Restore inlineRuns and join spanned runs in their own units, the span choice in linePass

This commit is contained in:
2026-11-03 15:16:28 +01:00
committed by Lillem4n
parent 6dbb1bd2a1
commit 5ee168efff
2 changed files with 80 additions and 60 deletions
+2 -2
View File
@@ -165,8 +165,8 @@ export function trimmedEdges(leaves: readonly AdfNode[]): AdfNode[] {
// 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))
// Judged beside the spanned line's nodes, so whitespace beside a code span inside a run keeps the run's mark.
const spanned = spannedNodes(merged, new Set()) ?? merged
// Judged beside the nodes as the spanned line writes them, a portable line carrying none, so whitespace beside a code span inside a run keeps the run's mark.
const spanned = spannedNodes(merged, new Set()).nodes
let changed = false
const trimmed: AdfNode[] = []
for (const [index, leaf] of merged.entries()) {