perf(editor): scope fold re-key to the edit (#142)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
With a fold open, every keystroke re-scanned the buffer, rebuilt the full attributed string through setAttributedString (invalidating TextKit layout for the ENTIRE document — O(n²) typing on folded documents), and rasterized a chrome image the size of the document (~35M pixels on a 700×50,000pt doc) to paint a handful of chevrons. Single-line edits now re-key folds in place: a shouldChangeText override records the edit (range + UTF-16 delta) and a pure rekey function shifts surviving folds, kills folds whose marker line was edited (un-hiding just that scope), and re-hides a line edited inside a hidden scope — no parents rescan, no storage swap. Structural edits, multi-line pastes, and wholesale loads keep the full pass; a font probe at each survivor's scope head falls back to it whenever hidden styling was wiped (the fence-flip restyle self-heals this way). Chrome renders as one tiny cached layer per list parent (same glyph rasters at ~15×18pt, geometry-flipped into the existing document-space overlay) instead of the document-sized bitmap; an edit at/after every parent line skips the rebuild outright, so writing at the document end does zero geometry queries. Full-buffer scans per keystroke drop from 2–3 to one. Finish-audit hardening: the single-line gate checks Character.isNewline (a literal newline compare passes CRLF — one grapheme equal to neither scalar), and apply() clears the recorded edit so structural indent/ outdent always takes the full pass (a childless unterminated block's shift-tab is a single-line replacement that would otherwise keep a dead fold's scope hidden — apparent line loss). Closes #142
This commit is contained in:
1 parent
de1154dacd
commit
cc317b65b9
9 files changed
+687
-114
No files matched your search
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-11-03 | issue | [20261103-issue142-fold-rekey-paragraph-scoped-chrome-layers_log.md](20261103-issue142-fold-rekey-paragraph-scoped-chrome-layers_log.md) | #142: single-line edits re-key folds in place; chrome becomes per-glyph layers — no more per-keystroke full-document restyle/raster |
|
||||
| 2026-11-02 | issue | [20261102-issue141-image-drop-illustration-ingest_log.md](20261102-issue141-image-drop-illustration-ingest_log.md) | Image drop → assets/ ingest at drop point; window-destination routing, firstRect viewport-band solve, finish-audit fixes |
|
||||
| 2026-11-01 | issue | [20261101-issue34-m6-illustrations-travel-inline-s6-2_log.md](20261101-issue34-m6-illustrations-travel-inline-s6-2_log.md) | #34 illustrations: media-endpoint upload, refs rewrite INLINE with URLs (dogfood killed the photo property); audit: injection/symlink/dedup — 546 tests |
|
||||
| 2026-10-31 | issue | [20261031-issue33-m6-micropub-draft-publish-s6-1_log.md](20261031-issue33-m6-micropub-draft-publish-s6-1_log.md) | Two-step Micro.blog publish: Micropub draft→update, Keychain token, trustworthyURL gate, category inert |
|
||||
|
||||
Reference in new issue
Block a user