Lines 49–56 at 110 (were 49–54 at 109)
5050interface FileState { 5151 readonly attrs: FileAttrs; 52+ /** Full history is retained only when a sequence caller explicitly requests it. */ 53+ readonly complete: boolean; 5254 /** The file's sequence, tombstones included: each line's n. */ 5355 readonly seq: Int32Array; 5456 /** Its visible lines' n, in order. */ Lines 72–78 at 110 (were 70–76 at 109)
7274const EMPTY_INTS = new Int32Array(0); 73−const NO_FILE: FileState = { attrs: NO_ATTRS, seq: EMPTY_INTS, vis: EMPTY_INTS, deletedBy: new Map() };
75+const NO_FILE: FileState = { attrs: NO_ATTRS, complete: true, seq: EMPTY_INTS, vis: EMPTY_INTS, deletedBy: new Map() }; 7577// Approximate retained-container costs for View.weight(): reference slots, 7678// object headers, and map/set entries. These are cache-budget units, not V8 Lines 316–322 at 110 (were 314–320 at 109)
316318 /** Lay out one file: its line tree from the set's atoms, linearized. */ 317− #layout(path: string): FileState {
319+ #layout(path: string, complete: boolean): FileState { 318320 const graph = this.graph; 319321 // For each attribute, the highest-priority setter in the set wins. 320322 const setters = new Map<string, { id: AtomId; value: string | null }>(); Lines 345–354 at 110 (were 343–351 at 109)
343345 const n = stack.pop()!; 344346 const deleters = graph.deleterSeqsOf(n); 345347 const by = deleters.length === 0 ? NONE : deleters.filter((d) => this.#has(d)); 346− if (by.length > 0) deletedBy.set(seq.length, by.length > 1 ? [...by].sort(priority) : by);
347− else vis.push(n);
348− seq.push(n);
348+ if (by.length > 0) { 349+ if (complete) deletedBy.set(seq.length, by.length > 1 ? [...by].sort(priority) : by); 351+ if (complete) seq.push(n); 351354 const attrs: FileAttrs = { Lines 357–363 at 110 (were 354–360 at 109)
354357 link: setters.get("link")?.value ?? null, 355358 blob: setters.get("blob")?.value ?? null, 357− return { attrs, seq: Int32Array.from(seq), vis: Int32Array.from(vis), deletedBy };
360+ return { attrs, complete, seq: Int32Array.from(seq), vis: Int32Array.from(vis), deletedBy }; 360363 get #known(): string[] { Lines 434–440 at 110 (were 431–437 at 109)
431434 sequence(path: string): readonly SeqLine[] { 432435 if (this.#seqCache?.path === path) return this.#seqCache.seq; 433436 const graph = this.graph; 434− const f = this.#file(path);
437+ const f = this.#file(path, true); 435438 const out: SeqLine[] = new Array(f.seq.length); 436439 for (let i = 0; i < f.seq.length; i++) { 437440 const n = f.seq[i]!; Lines 453–459 at 110 (were 450–456 at 109)
451454 /** Index of a line in `sequence(path)`, or -1. */ 452455 sequenceIndex(path: string, line: LineId): number { 453− const f = this.#file(path);
456+ const f = this.#file(path, true); 454457 if (!f.seqIndex) { 455458 f.seqIndex = new Map(); 456459 for (let i = 0; i < f.seq.length; i++) f.seqIndex.set(f.seq[i]!, i); Lines 531–540 at 110 (were 528–537 at 109)
531− #file(path: string): FileState {
534+ #file(path: string, complete = false): FileState { 532535 let state = this.#files.get(path); 533− if (!state) {
534− state = this.graph.atomsIn(path).length === 0 ? NO_FILE : this.#layout(path);
536+ if (!state || (complete && !state.complete)) { 537+ state = this.graph.atomsIn(path).length === 0 ? NO_FILE : this.#layout(path, complete); 535538 this.#files.set(path, state);