Skip to content

Keep editor typing out of Chromium's native undo stack; bound the PDF viewer; point docs at preview 5 - #47

Open
grawish wants to merge 5 commits into
mainfrom
ccr-8875ff0a-3wxw15
Open

grawish wants to merge 5 commits into
mainfrom
ccr-8875ff0a-3wxw15

Conversation

@grawish

@grawish grawish commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Editor memory (PERF-02). PR #42 traced Code-mode detached DOM to blink::UndoStack / blink::TypingCommand: Chromium records each natively applied insertion into CodeMirror's contenteditable in its own undo history, which Folio never uses (CodeMirror's history() is the user's undo). managedTextInput in src/editor-state.ts now applies committed, non-composing insertText through a CodeMirror transaction (as paste already is). Composition, replacement/autocorrect input, multiple selections and any DOM/editor selection mismatch keep the native path.

New npm run test:editor-native-undo (in source CI) bundles the real editor state into Electron and runs the retention workload against a native-input control. Identical on Linux and the hosted macOS 15 arm64 runner:

Case (Electron 44.4.5, 20 cycles, explicit GC) Detached nodes start → end Per cycle
Native-input control 14 → 8,221 410
managedTextInput 14 → 13 0

Typed text, undo, autocompletion, IME commit and Unicode input match in both. A separate comparison with the unchanged editor state matched click-then-type, undo grouping, IME commit/cancel, emoji cursor positions and selection replacement exactly.

Long-PDF viewer (PERF-02 workload). New npm run test:pdf-retention (in source CI) mounts the real PdfPreview in Electron and repeats 1-page → 100-page (scrolled fully) → 1-page replacements. Over 20 cycles: one live worker and blob URL, two canvases for 100 sheets, 1 detached node, collected heap 4.37 → 4.51 MiB after warm-up, renderer working set ~165 MiB flat, idle renderer CPU 0–0.2%. The viewer is not a source of the long-session growth or idle spikes.

Docs. Preview 5 (tag 36f5615) ships features tutorials and feature pages still called "development only / not in preview 4". Updated tutorials, feature/status pages, README qualification summary and the REMAINING_WORK.md starting-point table; regenerated Skill references. Measurements recorded in PROCESS_RESOURCE_PROFILE.md.

Not established

Neither check uses the packaged app. PERF-01/PERF-02 stay open until the 120-cycle macOS profile and packaged test:editor-input cases are repeated; AI-change, project-switch and long-history workloads need the full app.

Checks run

  • npm run typecheck, npm run build, npm run format:check, npm run website:build, npm run skill:build (no drift)
  • npm test: 553/553 on the macOS CI runner (locally one Linux-only platform guard in runtime-manager fails, unrelated)
  • npm run test:editor-native-undo and npm run test:pdf-retention: passed locally

🤖 Generated with Claude Code

https://claude.ai/code/session_01B9mvMLFE4he4Q6KqtoxeHY

claude added 5 commits October 7, 2026 03:35
Preview 5 (tag 36f5615) ships the features the tutorials still described
as development-only; refresh the REMAINING_WORK starting-point table,
README qualification summary and regenerated Skill references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B9mvMLFE4he4Q6KqtoxeHY
Chromium recorded every natively applied insertion in the editor's
contenteditable in blink::UndoStack, retaining replaced CodeMirror line
DOM while Code stayed mounted (PERF-02). Apply plain committed insertText
through a CodeMirror transaction, as paste already is; composition,
replacement input and selection mismatches keep the native path.

Add npm run test:editor-native-undo: in Electron 44 a native-input
control grows ~410 detached nodes per cycle, the managed path none, with
text, undo, autocompletion, IME and Unicode input unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B9mvMLFE4he4Q6KqtoxeHY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B9mvMLFE4he4Q6KqtoxeHY
Add npm run test:pdf-retention: the real PdfPreview in Electron repeats
1/100-page replacements with full scrolling and must keep one worker and
blob URL, windowed canvases, no detached growth and a flat collected
heap. Run it in source CI. Record that the native-undo check gives
identical counts on the hosted macOS 15 runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B9mvMLFE4he4Q6KqtoxeHY
@grawish grawish changed the title Keep editor typing out of Chromium's native undo stack; point docs at preview 5 Keep editor typing out of Chromium's native undo stack; bound the PDF viewer; point docs at preview 5 Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants