5645b926a3
Follow-up to #38. #38 made undo/redo re-inserted text neutral (no false human coloring); #40 restores its EXACT prior attribution so Claude's restored text is blue again, the human's green. Mechanism — text-keyed attribution snapshots: per-doc Map<documentText, spans>, snapshotted after every forward edit + at load; on undo/redo, after the #38 geometry reconcile, if a snapshot's text equals the current buffer the spans are restored exactly (offsets valid — identical text). Robust to VS Code undo coalescing (only the resulting-text-matching event restores); far-back/evicted states fall back to #38 neutral. History bounded (ATTR_HISTORY_MAX, oldest evicted). NOT MERGED / NOT VERIFIED END-TO-END: 222 unit + typecheck green, but the #40 host E2E (and the pre-existing #38 undoMarks E2E) depend on executeCommand("undo"), which is broken in this test environment — the untouched #38 test fails identically on clean main (the known undoMarks flake, now deterministic). Clearing .vscode-test/user-data (the usual remedy) is permission-blocked here. The operator should verify in a working E2E environment before merging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>