Lines 10–16 at 212 (were 10–16 at 211)
1010// made when a caller asks for them, and the latest asked for is kept. 1212import type { Graph, RelocationInfo } from "./graph.ts"; 13−import { isStartNode } from "./keys.ts";
13+import { isStartNode, seqOf } from "./keys.ts"; 1414import { resolveScratchMoves, scratchLayoutNodes } from "./relocation-scratch.ts"; 1515import { isClosedSet, StableSet } from "./state-source.ts"; 1616import { joinLines } from "./text.ts"; Lines 47–56 at 212 (were 47–53 at 211)
4949/** Structural read boundary shared by historical and transaction-bound projections. */ 50−export type ReadView = Omit<Pick<View, keyof View>, "sameText" | "visibleCount" | "shareMoves"> & {
50+export type ReadView = Omit< 51+ Pick<View, keyof View>, 52+ "sameText" | "visibleCount" | "shareMoves" | "fileOfNumber" | "lineNumberOf" | "visibleWriters" 5154 sameText(path: string, other: ReadView): boolean; Lines 283–298 at 212 (were 280–292 at 211)
280283 #fileOfShared: Map<number, string> | undefined; 283− * Take another view's resolved moves (abso Capacity). Only for a set that differs from that view's by atoms that
284− * move nothing, drop nothing and change no closure: its moves resolve the same, and every line it shares with that
285− * view sits where it sat there.
286+ * Take another view's resolved moves (abso Capacity), when both sets hold the very same atoms that move lines: the 287+ * moves then resolve the same, and every line sits where it sits there. Checked here, so any caller may ask. 287289 shareMoves(from: View): void { 288290 if (from.graph !== this.graph || from.#hasMoves !== this.#hasMoves || !this.#hasMoves) return; 289− if (from.#scratchMoves()) return;
291+ if (this.#relocs || from.#scratchMoves()) return; 292+ for (const id of this.graph.movers()) { 293+ const seq = seqOf(id); 294+ if (this.#has(seq) !== from.#has(seq)) return; 290296 this.#relocs = from.#relocations(); 291297 this.#relocsN = from.#relocationsN(); 292298 this.#movesOnDisk = false; Lines 702–712 at 212 (were 696–701 at 211)
696702 return [...this.#known]; 705+ /** The file line n sits in, in this set: fileOf by the line's number, with no lookup of its id. */ 706+ fileOfNumber(n: number): string { 707+ return this.#fileOfN(n); 699710 /** How many visible lines a file has. */ 700711 visibleCount(path: string): number { 701712 return this.#file(path).vis.length; Lines 860–884 at 212 (were 849–862 at 211)
850861 /** Index of a line in `lines(path)` (0-based visible line number), or -1 if not visible. */ 851862 lineNumber(path: string, line: LineId): number { 863+ return this.lineNumberOf(path, this.graph.lineN(line)); 866+ /** lineNumber by the line's number, with no lookup of its id. */ 867+ lineNumberOf(path: string, n: number): number { 852868 const f = this.#file(path); 853869 if (!f.visIndex) { 854870 f.visIndex = new Map(); 855871 for (let i = 0; i < f.vis.length; i++) f.visIndex.set(f.vis[i]!, i); 857− return f.visIndex.get(this.graph.lineN(line)) ?? -1;
873+ return f.visIndex.get(n) ?? -1; 876+ /** The seq of the atom that wrote each visible line, in order: lines() without ids or text. */ 877+ visibleWriters(path: string): number[] { 878+ const graph = this.graph; 879+ return Array.from(this.#file(path).vis, (n) => graph.writerSeqOf(n)); 860882 /** All projected text files, path -> text, in path order. Binary files are in `blobs()`. */ 861883 files(): Record<string, string> { 862884 const out: Record<string, string> = {};