Skip to content

Release 1.16.0 - #64

Merged
b451c merged 41 commits into
mainfrom
release/1.16
Nov 17, 2026
Merged

b451c merged 41 commits into
mainfrom
release/1.16

Conversation

@b451c

@b451c b451c commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Open a folder and read its Markdown files from the sidebar; numbered lists count up from their first number.

Added

Fixed

  • Numbered lists count up from their first number: 1. 1. 1. is shown as 1, 2, 3, and a list that starts with 5. goes on with 6, whatever numbers follow in the source. Switching between 1. and 1) starts a new list. (Numbered lists do not auto-increment #61).
  • A formula used as link text is drawn in the link's colour and underlined (in print/PDF: in the link's colour).
  • A line of three or more *, - or _ with spaces between them (* * *) is a horizontal rule.
  • A recent document that cannot be opened says so instead of doing nothing.
  • File ▸ Open Recent is back: on macOS 27 the menu showed an empty grey item in its place.

How

  • Lists: the drawn number is counted in one walk (MarkdownRenderer.orderedMarkers): the first item's number plus the position; a change between . and ) starts a new list; a line that is not an item continues a run only when an item owns it. Spaced rules are recognised by a byte scan, not a regular expression.
  • Open Folder: FolderListing.scan lists by name only and is bounded (depth, files, folders, entries read); FolderBrowserStore holds one folder with one scan in flight; the watcher judges file-system events off the main thread and reaches the main actor once per relevant batch. In the sandboxed build the chooser's answer is the folder grant.
  • A formula in link text is typeset in the link colour; the underline is drawn by the layout manager after the glyphs.
  • Open Recent: in an app that replaces .saveItem, SwiftUI's first menu update on macOS 27 leaves a bare NSMenuItem where the system's Open Recent was. OpenRecentMenu gives that item its title and a submenu again and does nothing where the system item is healthy.

Tests

1324 tests pass locally on a clean build; Debug, Release and Release with -DAPPSTORE build.

Closes #61
Closes #62

b451c and others added 30 commits November 17, 2026 14:05
An ordered item showed the number typed in the source, so `1.` `1.` `1.`
read 1. 1. 1. and `5.` `8.` read 5. 8. The run walk that already found
each list for the marker alignment is now the one place that decides the
list, the displayed number (first item's number + position) and the hang
(the widest displayed marker, so twelve `1.` items hang under "12. ").

Two run rules join the existing ones, as on GitHub: the other delimiter
(`.` vs `)`) starts a new list, and a line an item owns (after a hard
break, at the margin) no longer ends the item's list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FolderListing scans a folder for Markdown files (md, markdown, mdown, mkd,
any case): recursive to depth 8, at most 2 000 files, skipping hidden
items, packages and node_modules, never following symbolic links; grouped
by folder in Finder order. MarkdownFileKind is the one Markdown predicate.

FolderBrowserStore holds the one open folder: persisted under
openFolderPath, restored at launch (forgotten silently when gone or not
restorable), watched by one FSEventStream and re-scanned on change.

In the sandbox the folder chosen in Open Folder is a grant recorded by
FolderAccessBroker.registerUserChosenFolder (bookmark, access, coverage,
folderAccessGranted); unsandboxed nothing is registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ents sidebar (#62)

Open Folder... (Shift-Cmd-O, after the system Open items, app-level) runs
one folder chooser, shows the Documents sidebar and, with no document
window open, opens the root README.md or the first listed file. The
sidebar lists the folder above a "Recent" header; with no folder open it
is unchanged. Folder rows and recent rows open through one function, and
a failed open is a toast in the window instead of a debug assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts only (#61)

A paragraph or fence indented short of the item's content column is not
the item's: GitHub ends the list there, but the run walk looked only at
the indentation, so the count carried on (`1. a`, `  para`, `1. b` showed
1 and 2). Every non-item line now continues a run only when an item at
the run's level or deeper owns it (ListNesting): paragraph lines, rules
kept in a text row, and every kind of block under an item. Indentation
still decides for list-item lines and for direct callers of render(_:).

An ordered marker takes ASCII digits only (`١. a` is paragraph text on
GitHub; ListNesting.contentColumn already read ASCII only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… relevant changes (#62)

- One scan in flight per folder; events during it cause exactly one
  follow-up, no sooner than 1 s after it ended. Close and a new Open
  cancel the running scan between folders.
- A scan looks at no more than 20 000 entries (the root's own excepted)
  and never enters another volume or a volume root; a folder the budget
  does not cover lists nothing. Either cap reads "Showing the first N
  files" with N listed.
- The watcher drops event batches under .git, dot folders and
  node_modules (one name rule shared with the scan); an equal listing
  publishes nothing.
- open() returns only with a listing for its own folder, or when it was
  superseded; the flow then does nothing. A chosen folder that cannot
  be read is an alert, window or not.
- Restoring does no I/O on the main thread: the existence check runs off
  it, started once from the sidebar's first appearance.
- Gone forgets the folder, unreadable keeps it and its last listing.
- Listing URLs keep the canonical root's spelling and the sidebar
  compares them with the current document's canonical path.
- Finder order gets a deterministic tie-break.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rlined

`See [$x$](u)` drew the formula in the text colour with no underline:
the attachment carried `.link` and `.underlineStyle`, but its image was
typeset in the theme's text colour and TextKit 1 never underlines an
attachment's run.

- MathRendering.inlineImageInColor: the formula is typeset in the link's
  colour (an input of the image; the engine is untouched). nil falls back
  to inlineImage, so stubs keep working.
- FittingMathAttachment.linkUnderline + drawLinkUnderline, called after
  the glyphs by DocumentSelectionLayoutManager.drawGlyphs: AppKit's own
  text underline (a kerned no-break space in the link's font) so it meets
  the link text's underline exactly; at the bottom of the line when the
  formula reaches below the text's descenders or the line holds no text
  descent. The source box keeps its own underlined link text.
- Drawing only: bounds, the fit rule and every measured height unchanged;
  an unlinked formula is pixel-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrintableMath typesets a formula inside a link in the link's colour, and
its italic source fallback is link-coloured and underlined, as on screen.
SwiftUI Text draws no underline under an image, so the printed typeset
formula has none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`* * *`, `- - -`, `_ _ _` and `**  **` are rules on GitHub (CommonMark),
but the rule pattern wanted the characters touching, so `* * *` and
`- - -` were drawn as the bullets "• * *" / "• - -" and `_ _ _` as text,
and a list went on across them. The one pattern now takes three or more
of one character with spaces or tabs between; every reader of a rule
uses it and checks it before list items. Front matter and the setext
underline keep their exact `---`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r first number (#61)

Displayed number = the list's first number + position, decided in the same
run walk as the hang; a list goes on only past what its items own; a
delimiter change starts a new list; ASCII digits only; thematic breaks with
spaces between their characters.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…, never keeps a folder it could not open (#62)

- The cost cap counts folders read (2 000, root included) instead of
  entries, so one huge sibling no longer hides another; a folder read is
  listed whole. A truncated result never reads "No Markdown files": the
  sidebar says "This folder is too large to list" with no files listed,
  the no-window flow alerts "“name” is too large to list".
- An explicit Open of a missing or unreadable folder alerts and leaves
  no folder and no remembered path; only a folder listed this session or
  restored at launch is kept when it cannot be read.
- Missing vs unreadable comes from stat's error (LocalLinkOpening
  .existence): EACCES/EPERM is unreadable, so a remembered folder is not
  forgotten at launch over a permission.
- A kept unreadable folder shows "Can’t read this folder" under its
  header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn files in the Documents sidebar (#62)

One folder at a time, remembered until closed; a read-only list (no file
management). Scans run one at a time off the main thread, read names only,
are capped (2 000 folders, 2 000 files, depth 8) and are triggered only by
changes that can alter the list.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…draw

- drawTextUnderline reuses a scratch TextKit stack laid out once per
  (font, underline style, colour), bounded at 64 entries; per draw it is
  one clip and one glyph's underline. Rows are unchanged (probe: same
  pixel rows at 1x/2x, zoom 100/200, body and heading fonts).
- drawLinkUnderlines skips a formula shown as its source before any
  geometry and reads the laid-out size from the layout manager instead of
  calling attachmentBounds (two text layouts per draw for a source box).
- Test: 40 linked formulas drawn twice build at most one scratch stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every directory read adds the number of entries it returned to a running
total (the root's included); once it passes Limits.maxEntriesRead
(200 000) no further subfolder is read and the result is truncated. The
folders already read stay listed whole, so a scan costs at most that
total plus one folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…he link

Drawn in the link colour and underlined on screen (the underline joins the
neighbouring text's rows when the formula fits above them, the line bottom
otherwise); printed in the link colour. One underline layout per font, not
one per draw.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ger go blank (#62)

The folder list and the recent rows shared one LazyVStack and used the
same explicit id (the URL string) for a file in both sections; after an
insert the recent row kept its space but drew nothing. Every row of that
stack now takes its id from SidebarRowID (folder group, folder file,
recent), disjoint by construction. The no-folder branch is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ss the folder list and Recent (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The spaced-rule pattern (28a947e) is tried on every line that starts
with `-`, `*` or `_` - every bullet - and no longer failed at the second
character, so opening an 11 400-bullet document cost ~40 ms more. One
hand-written scan (`MarkdownRenderer.isRuleRun`, on the trimmed line's
UTF-8, no allocation) now answers for every reader of a rule; the
pattern constant is gone. A test checks it against the old pattern for
every string of up to seven characters over the rule alphabet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e scan (#61)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…entation

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The watcher now takes item events (FileEvents) and judges each by path
and flags: an item created, removed or renamed, a folder's permissions or
owner (ItemChangeOwner with ItemIsDir, which chmod of a directory
delivers, the root included), or a "look again" flag re-scans. A content
write, a file's chmod, xattrs and a folder's mtime do not. A listed
folder made unreadable now shows "Can't read this folder", and a kept
unreadable folder made readable lists again, without waiting for an
unrelated change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… list; the watcher judges item events (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The FSEventStream is delivered on a private serial utility queue, where
FolderEventBatchFilter tests each event's flags first and then its path
as UTF-8 bytes against both spellings of the root, without bridging or
allocating per component, and stops at the first relevant change. Only a
batch with a relevant change hops to the main actor, once; an npm
install or git checkout under node_modules/ or .git/ never reaches it.
The stream is released in a block on its own queue that holds the
filter, so the filter outlives every callback. The name rule is decided
on bytes in both the scan and the watcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file or symlink event whose name has no Markdown extension cannot
change the listing, whatever happened to it: a build writing thousands
of object files re-read the whole tree every second. A rename delivers
one event per name, so .txt -> .md and .md -> .txt are still seen.
Folder events, events of unknown kind and "look again" flags stay
relevant. Decided on bytes in the watcher's filter, with the String
reference rule kept in step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and count only for Markdown names (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
#62)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FSEvents may name a hard-linked file's event by another link, so an
event carrying ItemIsHardlink or ItemIsLastHardlink no longer takes the
non-Markdown-file exemption, in the reference rule and the byte rule.
Two doc comments now name the watcher's real filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-Markdown file; the scan's dot test is the byte rule (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
b451c and others added 11 commits November 17, 2026 17:08
…#62)

The restore's off-main work now also resolves both spellings of the
root (canonical and realpath) through an injectable seam and carries
them to the main actor, which starts the session and the watcher without
a file-system call of its own. An explicit Open resolves synchronously
as before, so a later Open still supersedes an earlier one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
registerUserChosenFolder is a no-op for a folder already granted in this
session, and saveGrant leaves a folder that is already saved and active
alone (no duplicate saved entry, no unbalanced access start); a saved
folder that is not active gets a fresh bookmark without a second entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two exact shortcuts from the 1.16 review: the block loop asks whether a
text line is a rule (for its owning item) only while an item is open,
and renderLine hands the line it has already trimmed to orderedItem.
A test pins the parse of eight adversarial documents to values captured
before the change (indents compared by value, never as font constants).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repeated-grant guard now compares the EXACT bookmark key that
restoreAccess looks up for the chosen URL (bookmarkKeyPath, shared with
SandboxAccessManager.bookmarkKey), not the canonical path. A folder
granted as /private/tmp/x and chosen as /tmp/x (or through a symlink) is
saved under the chosen spelling again, so it is restored at relaunch; the
same spelling chosen again is still saved once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, one trim per line (#61)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…; a folder chosen again adds no second grant (#62)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With CommandGroup(replacing: .saveItem), SwiftUI's first lazy update of
the main menu removes AppKit's Open Recent item and inserts a bare
NSMenuItem() that it never configures. OpenRecentMenu, installed in
applicationDidFinishLaunching, watches the menu's add / change
notifications and turns that blank item (the one right after Open…)
into Open Recent in place, with a submenu of its own: the recent list
without file-system access, same-name entries with their folder, Clear
Menu. Entries open through DocumentOpener; a failure shows the Open
Folder flow's alert, now one shared MessageAlert. Healthy shapes are
left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS 27 decides menu item image visibility and typically hides them;
each entry now asks for a visible image through the 27 SDK's
preferredImageVisibility, called by name behind responds(to:) because CI
builds with an older SDK. Clear Menu and the separator are untouched;
macOS 13-26 call nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… menu

A change on the main menu itself (a File menu built detached, then
attached) now runs the repair over its top-level submenus; before, only
changes inside a top-level submenu did. Documents that nothing of ours
may sit directly after the system's Open… (a disabled button there
would look like the blank), and states what the one-submenu test proves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S 27

SwiftUI's first menu update leaves a bare NSMenuItem where the system's
Open Recent was (an app that replaces .saveItem). OpenRecentMenu repairs
that item in place: title, a submenu with the recent files and their
icons, Clear Menu. A no-op wherever the system item is healthy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…Recent back

Version 1.16.0 (build 34), CHANGELOG, README (Open Folder, its shortcut,
the plan issue #63), PRIVACY (what Open Folder reads and remembers).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@b451c
b451c merged commit ce51c4c into main Nov 17, 2026
3 checks passed
@b451c
b451c deleted the release/1.16 branch November 17, 2026 18:28
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.

Add the ability to open a folder and browse Markdown files Numbered lists do not auto-increment

1 participant