{"draft":null,"from":211,"to":212,"files":[{"path":"src/engine/view.ts","added":29,"removed":7,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -10,7 +10,7 @@\n // made when a caller asks for them, and the latest asked for is kept.\n \n import type { Graph, RelocationInfo } from \"./graph.ts\";\n-import { isStartNode } from \"./keys.ts\";\n+import { isStartNode, seqOf } from \"./keys.ts\";\n import { resolveScratchMoves, scratchLayoutNodes } from \"./relocation-scratch.ts\";\n import { isClosedSet, StableSet } from \"./state-source.ts\";\n import { joinLines } from \"./text.ts\";\n@@ -47,7 +47,10 @@\n }\n \n /** Structural read boundary shared by historical and transaction-bound projections. */\n-export type ReadView = Omit<Pick<View, keyof View>, \"sameText\" | \"visibleCount\" | \"shareMoves\"> & {\n+export type ReadView = Omit<\n+\tPick<View, keyof View>,\n+\t\"sameText\" | \"visibleCount\" | \"shareMoves\" | \"fileOfNumber\" | \"lineNumberOf\" | \"visibleWriters\"\n+> & {\n \tsameText(path: string, other: ReadView): boolean;\n };\n \n@@ -280,13 +283,16 @@\n \t#fileOfShared: Map<number, string> | undefined;\n \n \t/**\n-\t * Take another view's resolved moves (abso Capacity). Only for a set that differs from that view's by atoms that\n-\t * move nothing, drop nothing and change no closure: its moves resolve the same, and every line it shares with that\n-\t * view sits where it sat there.\n+\t * Take another view's resolved moves (abso Capacity), when both sets hold the very same atoms that move lines: the\n+\t * moves then resolve the same, and every line sits where it sits there. Checked here, so any caller may ask.\n \t */\n \tshareMoves(from: View): void {\n \t\tif (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves) return;\n-\t\tif (from.#scratchMoves()) return;\n+\t\tif (this.#relocs || from.#scratchMoves()) return;\n+\t\tfor (const id of this.graph.movers()) {\n+\t\t\tconst seq = seqOf(id);\n+\t\t\tif (this.#has(seq) !== from.#has(seq)) return;\n+\t\t}\n \t\tthis.#relocs = from.#relocations();\n \t\tthis.#relocsN = from.#relocationsN();\n \t\tthis.#movesOnDisk = false;\n@@ -696,6 +702,11 @@\n \t\treturn [...this.#known];\n \t}\n \n+\t/** The file line n sits in, in this set: fileOf by the line's number, with no lookup of its id. */\n+\tfileOfNumber(n: number): string {\n+\t\treturn this.#fileOfN(n);\n+\t}\n+\n \t/** How many visible lines a file has. */\n \tvisibleCount(path: string): number {\n \t\treturn this.#file(path).vis.length;\n@@ -849,14 +860,25 @@\n \n \t/** Index of a line in `lines(path)` (0-based visible line number), or -1 if not visible. */\n \tlineNumber(path: string, line: LineId): number {\n+\t\treturn this.lineNumberOf(path, this.graph.lineN(line));\n+\t}\n+\n+\t/** lineNumber by the line's number, with no lookup of its id. */\n+\tlineNumberOf(path: string, n: number): number {\n \t\tconst f = this.#file(path);\n \t\tif (!f.visIndex) {\n \t\t\tf.visIndex = new Map();\n \t\t\tfor (let i = 0; i < f.vis.length; i++) f.visIndex.set(f.vis[i]!, i);\n \t\t}\n-\t\treturn f.visIndex.get(this.graph.lineN(line)) ?? -1;\n+\t\treturn f.visIndex.get(n) ?? -1;\n \t}\n \n+\t/** The seq of the atom that wrote each visible line, in order: lines() without ids or text. */\n+\tvisibleWriters(path: string): number[] {\n+\t\tconst graph = this.graph;\n+\t\treturn Array.from(this.#file(path).vis, (n) => graph.writerSeqOf(n));\n+\t}\n+\n \t/** All projected text files, path -> text, in path order. Binary files are in `blobs()`. */\n \tfiles(): Record<string, string> {\n \t\tconst out: Record<string, string> = {};"}],"unmatched":[]}