Hotfix v2.4.1-undead: preview refresh on macOS 27, and the untitled.markdn extension - #90
Merged
Merged
Conversation
A refreshing command's new page goes into the page cache and the web view reloads its URL, which the scheme handler then serves from the cache. The Markdown preview sets location.hash on its first load, and WebKit asks the handler for the reload with that fragment included. The handler keyed its lookups by the full URL, missed, and served the 404 path, so the page never showed the new content: the preview stopped following edits, from v2.4.0 on. The page cache now defines a page's key as its URL without the fragment and the handler and the view both use it.
A grammar's fileTypes go into the item's field multimap one entry per value. value_for_field() used find(), which on libc++ lands on any node with the key, so the extension suggested for a new file was whichever entry the tree search hit: "markdn" for Markdown, whose grammar lists "md" first. lower_bound() gives the first entry in file order.
Committing the fixture replaced the index the query tests in the same run rely on, which failed four of them. The item on its own is all the test needs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hotfix for v2.4.0 on macOS 27: an auto-refreshing preview never showed the edit.
What breaks. A refresh re-serves the page under its own URL and reloads it. The Markdown preview sets
location.hashon its first load. On macOS 27, WebKit asks the scheme handler for the reload with that fragment attached; on macOS 26 it asks with the plain URL. The handler keyed the streaming metadata and the page cache by the full URL, so on 27 the lookup missed, the handler served its 404 path, and the page stayed as it was. Reproduced on a build ofecd4a2a1on macOS 27.0 by typing into a previewed document, on disk or untitled, pane or window, and confirmed not to reproduce on 26.7.Fix. The page cache defines a page's key as its URL without the fragment, and both the handler and the output view use it. Test added. Verified on macOS 27: typed markers now appear in the preview after each refresh.
Also included, unrelated but small: the extension suggested for a new file is the first entry of the grammar's file types, not whichever entry the field lookup landed on, so a new Markdown file is
untitled.mdrather thanuntitled.markdn. Test added, and it fails against the old lookup.The CHANGELOG entry cuts v2.4.1-undead; merging starts the release workflow.