{"draft":null,"from":121,"to":318,"files":[{"path":"src/engine/conflicts.ts","added":14,"removed":22,"diff":"--- a/src/engine/conflicts.ts\n+++ b/src/engine/conflicts.ts\n@@ -126,11 +126,19 @@\n /** `a` has the lower seq. */\n function makeConflict(graph: Graph, set: AtomSet | undefined, a: Atom, b: Atom, keys: ConflictKey[]): Conflict {\n \tconst kind = keys.every((k) => k.relation === \"hold\") ? \"semantic\" : \"edit-edit\";\n-\tlet resolvedBy: AtomId[] = [];\n+\tconst resolvedBy: AtomId[] = [];\n \tif (set) {\n-\t\tconst fromA = graph.resolversOf(a.id).filter((r) => set.has(r));\n-\t\tconst fromB = new Set(graph.resolversOf(b.id));\n-\t\tresolvedBy = fromA.filter((r) => fromB.has(r)).sort((p, q) => graph.atom(p).seq - graph.atom(q).seq);\n+\t\t// Resolver indexes append in sequence order: intersect without copying either history.\n+\t\tconst left = graph.eachResolverOf(a.id);\n+\t\tconst right = graph.eachResolverOf(b.id);\n+\t\tlet p = left.next();\n+\t\tlet q = right.next();\n+\t\twhile (!p.done && !q.done) {\n+\t\t\tconst order = graph.atom(p.value).seq - graph.atom(q.value).seq;\n+\t\t\tif (order === 0 && set.has(p.value)) resolvedBy.push(p.value);\n+\t\t\tif (order <= 0) p = left.next();\n+\t\t\tif (order >= 0) q = right.next();\n+\t\t}\n \t}\n \treturn { atoms: [a.id, b.id], kind, keys, sides: [side(a), side(b)], resolvedBy };\n }\n@@ -199,23 +207,7 @@\n function visibleNeighbours(view: View, graph: Graph, line: LineId): LineId[] {\n \tconst info = graph.line(line);\n \tif (!info) return [];\n-\tconst sequence = view.sequence(info.file);\n-\tconst at = view.sequenceIndex(info.file, line);\n-\tif (at < 0) return [];\n-\tconst out: LineId[] = [];\n-\tfor (let i = at - 1; i >= 0; i--) {\n-\t\tif (sequence[i]!.visible) {\n-\t\t\tout.push(sequence[i]!.id);\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\tfor (let i = at + 1; i < sequence.length; i++) {\n-\t\tif (sequence[i]!.visible) {\n-\t\t\tout.push(sequence[i]!.id);\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\treturn out;\n+\treturn view.visibleNeighbours(info.file, line);\n }\n \n /**\n@@ -253,7 +245,7 @@\n \tconst seen = new Set<string>();\n \tfor (const a of [...changed].sort(bySeq(graph))) {\n \t\tif (a === atom.id) continue;\n-\t\tfor (const link of graph.togetherLinks(a)) {\n+\t\tfor (const link of graph.eachTogetherLink(a)) {\n \t\t\tconst b = link.other;\n \t\t\tif (b === atom.id || !set.has(b) || acknowledged.has(b)) continue;\n \t\t\tconst tag = `${a} ${b}`;"}],"unmatched":[]}