Skip to content

0.11.0 — Ordered-list numbering, cursors on inverted spans, fast large notes

Latest

Choose a tag to compare

@luca-chen198 luca-chen198 released this 31 Jul 18:02

Ordered lists render their position

An ordered item's number is computed from its place in the run and painted over the source digits, so typing, deleting, merging and pasting renumber live. The .md file is never rewritten — the source stays valid CommonMark whatever it says. The whole source marker is hidden as one unit and the slot is kerned to the display width, so the dot travels with the digits at any digit count; the raw digits are revealed while they are edited.

Cursors that survive an inverted span

New opt-in MarkdownEditorConfiguration.cursorFollowsSpanInk (off by default). Caret and I-beam take the ink of the extension span they sit in — it only matters for an extension that INVERTS its content, where both cursors are otherwise drawn in the block's own color and vanish inside it. InvertedIBeamCursor recolors the live NSCursor.iBeam image, so the system shape and the user's pointer size are preserved.

Large notes open ~14× faster

Measured on a 346k-char / 5,241-block note, Release:

before after
first open 19.5 s 1.35 s
warm open 1.1 s 590 ms
switch away 440 ms 115 ms

Styling is built on a detached string and transferred with one setAttributedString (per-key addAttribute on live TextKit-2 storage left weak tombstones in Foundation's attribute-intern table, which turned quadratic), the restyle apply uses a paragraph overlap index, the redundant second parse and the re-entrant full-document layout are gone, and the SwiftMath render cache persists to disk (717 ms → 35 ms on relaunch, byte-identical geometry).

Editing long ordered lists came along: one Return in an 800-item loose list 944 ms → 67 ms (was quadratic), typing in a 1,600-item list 89 ms → 41 ms per key.

Fixed

  • Find-in-document no longer erases other backgrounds. Clearing its highlights removed .backgroundColor across the whole document, blanking extension spans, code fences and table cells until an unrelated restyle repainted them.

Known limitations

  • A list item's continuation line is a paragraph and ends the run, so a multi-line item switches numbering off below it.
  • A loose list keeps stale numbers after a pure digit edit.
  • Ordered task items (1. [ ] x) consume a number but render none.

Full changelog: 0.10.1...0.11.0

Contributors

by @luca-chen198 — ordered-list display numbering (#111), the ink-following caret and I-beam (#111), the large-file open overhaul (#107), and the find-highlight fix.