Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Index: open questions from the recent fix series, and where things stand

Open PathGao opened this issue 4 months ago • 8 comments

Status, 2026-08-06. Four of the ten rows below have since been answered and closed, and one has had its premise removed. Rather than rewrite the table and lose the record, the update is here and the original is unchanged underneath.

then now
#391 undo destroyed on tab switch closed — #471, one Monaco model per tab
#392 Ctrl+T means three things closed — #480, one meaning, and the blank Home tab is gone
#368 undo deletes pasted images closed
#385 stale AGENTS.md statements closed — #475
#395 portable and installer are one binary premise removed — #481 deleted the installer and uninstaller outright, on your call in #466. Closing it separately.
#393 Monaco defaults never audited partly answered — ~154 defaults examined, #492 landed two. Status comment on the issue.

Still yours to call: #390, #394, #372, #373. Those four are unchanged.

Also from that list: "#122 has a one-line cause — create_shortcut never calls create_dir_all" is no longer true. create_shortcut was deleted with the rest of the installer in #481; NSIS creates the shortcuts now. Noted on #122.

Since this index was written, 2.7.1 is ready to cut — see #496.


@alecdotdev — I've been working through a backlog of defects over the last stretch and there are now a handful of decisions that are yours rather than mine. Rather than pinging you on each one, here is a single index. Nothing here is urgent and nothing needs a long reply — a one-line "yes/no/not now" on any of them is enough, and I'm happy to implement whichever way you point.

Decisions I'd like your call on

Question
#390 ⌘Q discards the session snapshot while the red X keeps it, and quit only closes the focused window. Both live in appExit(), so they're one decision. My reading is that the discard is deliberate — the confirm dialog literally promises it — but that dialog only appears when a tab is dirty, so most people never see the sentence that explains the design.
#391 Undo history is destroyed on every tab switch, because one Monaco model is shared by all tabs and setValue clears the undo stack by definition. Fix is one model per tab (Monaco's intended usage), but it changes observable behaviour and adds model lifetime management.
#392 Ctrl+T means three different things across platforms, and the Home tab it opens on Windows/Linux renders blank.
#393 Monaco's defaults were never audited — that's why fullwidth CJK punctuation gets outlined (#186, #94) and why Vim's whole z family is dead (#104). Offering to bring a list before touching anything.
#394 img-src https: means opening an untrusted .md can silently contact a third party; assetProtocol.scope: ["**"] exposes the filesystem. Both look like deliberate trade-offs — I'd like to know if they are, so they can be recorded as such.
#395 The portable and installer .exe are the same binary distinguished by filename, and re-running the installer after installing silently opens the app instead of offering Repair/Uninstall.
#368 Undo deletes pasted/dropped images permanently, and sometimes the wrong one. Three separate defects; I closed my own PR for it because the prior question is whether that deletion should exist at all. Obsidian and Typora keep the file and make orphan cleanup an explicit command.
#372 Non-UTF-8 documents. #379 has landed the stop-loss (they open, but saving over the original is refused), so nothing is destroyed now. The open question is whether you want real encoding detection, which means a new dependency.
#373 Saving a read-only file: hard error, or a "this file is read-only, overwrite?" prompt like VS Code. #371 made all three platforms fail consistently, which removed a capability Unix users had.
#385 Three stale statements in AGENTS.md — most importantly that the frontend has no test framework, when there are 67 test files and CI runs them. Happy to PR it if you'd rather not.

Where the code stands

Roughly 60 commits are on master but unreleased. Several of those fix things people reported (checkbox toggling, preview width, Ctrl+O, PDF layout), so a release would let reporters confirm on their own machines rather than taking my word for it.

I've deliberately not closed any issue, even where the fix looks complete — I'd rather the reporter confirms against a build than have me close it from reading the code. I'll comment on the relevant ones with what changed and which PR did it.

Two more things worth flagging, neither needing a decision:

  • #197, #177 and #174 are one bug, not three. comrak runs CommonMark inline rules inside math delimiters, so \\ collapses a multi-line aligned into one line, \% makes KaTeX treat the rest as a comment, and _{1} becomes <em>. The current guard protects only _ and only $$ — the intersection of the three. Masking the whole delimited span before comrak and restoring after fixes all three at once. I'm working on that.
  • #122 has a one-line cause underneath the failure #364 made recoverable: create_shortcut never calls create_dir_all, so a missing Desktop or Start Menu directory fails the install outright.

Thanks for merging the recent series — happy to keep going, slow down, or drop anything you'd rather not carry.

PathGao avatar Aug 02 '26 21:08 PathGao

@alecdotdev — a status update, since a lot has landed and the index above has moved.

What went in

50 PRs merged onto master. The ones I would actually want you to know about:

Documents being destroyed. A >50KB file opened as a truncated preview could be written back over the whole document (#374). A non-UTF-8 file opened as mojibake and auto-saved over the original 1.5s later (#379). Dropping two same-named images in the same second silently replaced the first, while the document still linked to it (#383). A failed read during session restore evicted the tab and wrote the trimmed list back, so an unplugged drive lost the tab permanently (#401). Re-opening a file that was already open with unsaved edits discarded them — and cleared the dirty flag, so nothing told the user (#412). Two tabs could hold one path with two auto-save timers writing over each other (#413).

Security. Exported HTML bypassed the sanitizer entirely (#376). The preview never used the shared sanitize policy, so a document's <style> reached the app's own DOM — measured hiding the title bar and fetching a remote beacon (#384). A link could read as http://… in the status bar and open a local file (#415).

Three reports turned out to be one bug. #174, #197 and #177 are all comrak running CommonMark inline rules inside math delimiters — _{1} becoming <em>, \\ eaten so a multi-row aligned collapses to one line, \% eaten so KaTeX treats the rest as a comment. Fixed together in #402 by masking the whole span before comrak instead of patching one character class.

Windows. Install failed outright when the Desktop or Start Menu directory did not exist, which is #122's cause (#400). Uninstall could terminate unrelated processes with the same name (#358). Export inlined no local images at all (#363).

Also: the editor context menu was half English and did not follow a language change; a PDF exported from edit mode was blank; Copy Reference produced a link Markpad itself could not follow; open_path was rejected by the opener scope, so "open the exported file" had never worked.

Two things you may want to weigh in on

A release would be useful. Around 70 commits are on master unreleased, and several fix things people reported — checkbox toggling, preview width, Ctrl+O, PDF layout, scroll sync. I have commented on those issues but closed none of them: I would rather the reporter confirmed against a build than have me close it from reading the code.

The open questions in this issue are still open — #390 through #395, plus #368, #372, #373 and #385. None of them is urgent and a one-line answer on any is enough. Where I could not tell whether something was deliberate, I said so rather than guessing: #390 in particular reads to me like an intentional design that is simply never explained to the user on the path most people take.

Happy to keep going, slow down, or drop anything you would rather not carry.

PathGao avatar Aug 03 '26 06:08 PathGao

@PathGao I'll do a full review and test of everything that's hit master tomorrow. in the meantime you can take a break until everythings reviewed and a release is put through.

If you have a rough summary of changes we can use for release notes + screenshots wherever applicable, that'd be great.

cheers!

alecdotdev avatar Aug 03 '26 12:08 alecdotdev

Thanks — and sorry about the volume. 120 PRs since v2.6.13 is a lot to hand someone at once, and reviewing it is going to be more work than writing it was. Happy to answer questions on any of it, and equally happy for you to drop anything you'd rather not carry.

Below is a rough cut for release notes, grouped by what a user would notice rather than by PR. (Edited to add ~20 fixes I had left out of the first pass — the Windows "Move to New Window" freeze in particular deserved to be in there.) Cherry-pick freely — I've kept PR numbers on each line so you can drop the ones you don't want to mention. Screenshot suggestions are at the end.


Draft release notes

New

  • Preview width is configurable — a setting, a shortcut pair to widen/narrow, and the preference persists (#346, #347, #348, #349)
  • Editor toolbar — new icons and a show/hide toggle (#282)
  • Window tags and pinned sessions rebuilt (#280)
  • Moving tabs between windows rebuilt (#279)
  • macOS settings menu (#339)
  • Floating table-of-contents toggle (#331)

Your documents

Six ways a document could be damaged, all closed:

  • A file over 50 KB opened as a truncated preview, and saving wrote that preview back over the whole document (#374)
  • A non-UTF-8 file opened as mojibake, and auto-save wrote the mojibake over the original 1.5 s later (#379)
  • Dropping two images with the same name in the same second silently replaced the first while the document still linked to it (#383)
  • A read failure during session restore evicted the tab and saved the trimmed list, so an unplugged drive lost the tab permanently (#401)
  • Re-opening a file that was already open with unsaved edits discarded them, and cleared the dirty flag so nothing said so (#412)
  • Two tabs could hold one path with two auto-save timers writing over each other (#413, #416)

Also: a tab moved between windows could end up open in both, each copy with its own auto-save timer writing over the other (#366). Pressing ⌘S while an auto-save was mid-write could leave the older text on disk (#436, #438). Quitting with two tagged windows could lose one window's pinned tags (#424). A stale preview render could overwrite a newer one (#254), and an interrupted session restore left the app unable to recover (#260).

Security

  • Exported HTML skipped the sanitizer entirely (#376)
  • The preview never used the shared sanitize policy, so a document's <style> reached the app's own UI — reproduced hiding the title bar and fetching a remote beacon (#384)
  • A link could read as http://… everywhere the user can see it and open a local file instead (#415)
  • Imported VS Code theme colours are validated before being injected as CSS (#362), and imported theme slugs are normalized (#301)
  • Theme and image file paths are constrained to their directories (#249, #270)
  • File IO, decoding and Markdown boundaries hardened on the Rust side (#371)

Export and printing

  • Exported HTML now contains rendered math, syntax highlighting and Mermaid diagrams instead of raw source (#411)
  • Exported HTML carries the theme, and no longer cuts collapsed sections out of the document (#382)
  • PDF exports are readable in every theme — diagrams no longer come out dark-on-dark (#359)
  • A PDF exported from edit mode is no longer blank (#407)
  • Local images are inlined on Windows (#363)
  • Find highlights no longer print, and collapsed matches are revealed (#377)
  • Print layout: native controls, full page width, and tighter content rhythm (#329, #333)
  • The export menu is no longer greyed out for an unsaved document you're editing (#441)

Editor and preview

  • Task checkboxes work in the preview, and the change is written back to the file (#345, #352)
  • Three separate LaTeX reports turned out to be one bug — _{1} becoming italics, \\ being eaten so a multi-row aligned collapses, \% being eaten so KaTeX treats the rest of the line as a comment. All three are comrak applying Markdown inline rules inside math delimiters; fixed by masking the span before parsing rather than patching one character at a time (#351, #402 — closes #174 / #177 / #197)
  • Escaped dollars stay escaped, and $$…$$ inside a paragraph renders (#422)
  • The editor context menu is fully localized and follows a language change (#381)
  • URLs pasted inside code blocks are no longer turned into links (#381)
  • Scroll position returns to the block you left, not to a percentage (#420)
  • Heading folds are per-document, and are cleared when a tab follows a link to a different file (#425, #448)
  • A leading --- no longer swallows the paragraph after it (#375)
  • Copy Reference produces a link Markpad can actually follow (#403)
  • Preview works without saving first (#421)
  • ToC jumps use heading source position (#335)
  • Editor options and keyboard shortcuts now do what their labels claim (#369)
  • Saving works from reading mode (#365)
  • "Save image as" works for local images, and says so honestly for remote ones (#408)
  • A relative link to a non-Markdown file resolves against the document instead of the app (#409, #415)
  • Copy Reference produces a link Markpad can follow (#380), and "open the exported file" had never worked because the opener plugin had no path scope (#403)
  • Live Mode watched the wrong file after a tab switch (#296)
  • YouTube embeds open externally instead of failing in place (#338)
  • Settings: the modal stays draggable (#312), collapsed toolbar sections are remembered (#286), and every setting syncs across windows instead of the last window overwriting the rest (#370)
  • Recent files are merged across windows instead of overwritten (#405)
  • The auto-save failure toast no longer repeats (#406)
  • A malformed UTF-8 code fence crashed the renderer (#265)
  • Window titles update natively (#288); a window created at startup is reused instead of a second one appearing (#318)

Windows

  • "Move to New Window" froze the app. create_transfer_window built the window synchronously, and on Windows that deadlocks — WebView2 needs the main thread free to pump messages while the window is created (#360)
  • Right-clicking a tab twice opened the document menu the second time, because the first menu's full-viewport overlay swallowed the click and only called preventDefault() (#360)
  • Install failed outright when the Desktop or Start Menu folder did not exist — this is the cause of the OS Error 3 reports (#400)
  • Uninstall could terminate unrelated processes with the same name (#358)
  • Install and uninstall are recoverable if interrupted (#364)
  • Markpad no longer registers itself for plain text files (#302)
  • The Install button stays reachable at large system text sizes (#428)

macOS

  • PDF export did not work at all (#287)
  • Opening several documents at once from Finder kept only one of them (#298, #300)
  • The editor paste menu was missing (#266)

Performance

  • Startup JavaScript down 81 % — Monaco now loads when you open the editor rather than before the first paint. First paint went from 4770 KB to 904 KB; entering edit mode costs ~330 ms once per window (#423)
  • Mermaid-heavy documents ~12× faster to type in — diagrams are no longer redrawn on every keystroke (2185 ms → 189 ms on a 20-diagram document) (#419)

Under the hood

Around 30 of the PRs are refactors, tests and build work with no user-visible effect: extracting the window/document session logic out of the 4000-line viewer, pinning the Rust↔frontend render protocol, upgrading comrak from 0.18 (2023) to 0.54, and bringing the test suite from 109 to 596 tests. Nothing there needs a release note — mentioning it only if you want a "and a lot of groundwork" line.


Screenshots

I don't have any prepared. These are the ones where a screenshot would carry the note better than the sentence does, roughly in order of value — tell me which you want and I'll produce them:

shot
Preview width (#346–349) settings panel + a narrow/wide before-after on the same document
Exported HTML (#411) before/after of the same document — raw E = mc^2 and unhighlighted code vs. rendered
PDF in dark theme (#359) before/after of a page with a Mermaid diagram
Editor toolbar (#282) the toolbar, and the show/hide toggle
Window tags / pinned sessions (#280) the tag UI
Floating ToC toggle (#331) before/after
Installer at 125 % text (#428) before/after — this one is the clearest single before/after in the set

The two performance items are numbers rather than pictures; a DevTools network panel before/after would work for #423 if you want one.


One thing worth deciding before the release

I've commented on the reported issues this fixes — checkbox toggling, preview width, Ctrl+O, PDF layout, scroll sync — but closed none of them, on the grounds that the reporter should confirm against a build rather than have me close it from reading the code. I closed exactly one (#319), and only because its stated premise no longer exists in the source; the comment there says plainly that it hasn't shipped yet.

If you'd rather I close the clearly-fixed ones now, say so and I'll go through them. Otherwise I'll wait until after the release and ask each reporter to confirm.

Take the time you need on the review — nothing here is urgent, and I'm not adding to the pile in the meantime.

PathGao avatar Aug 03 '26 14:08 PathGao

@PathGao

proposed screenshot selection is perfect, if you could get those + the #423 one that'd be great. and possibly just one of an example usecase on macOS to use for an updated README and markpad.dev pictures, ill take care of a sample Windows pic.


checkbox toggling, preview width, Ctrl+O, PDF layout, scroll sync

we can put release out first and request followup from affected users.


i'll start a build workflow for the release. anything else needed before releases?

alecdotdev avatar Aug 04 '26 22:08 alecdotdev

I opened some issue if you can decide some of them we can solve them in this release. I will try to give you screenshots now

PathGao avatar Aug 04 '26 22:08 PathGao

@alecdotdev wait a moment,still several pr for this release to solve some little problems。

PathGao avatar Aug 04 '26 23:08 PathGao

@alecdotdev — screenshots are in, and the queue is empty. I think you can cut the release.

Screenshots

pics/2.7.0/, merged in #461 — eleven images, all macOS, all against the same document so each before/after pair differs only in the thing it is about. #461's body has a caption per file if you want to lift them straight into the notes. Take whichever are useful; nothing references those paths yet, so deleting one breaks nothing.

Three you asked for that aren't there:

  • #428, the installer at large text — Windows only. And the draft line for it is wrong, which is my fault for not catching it earlier: it reads "The Install button stays reachable at large system text sizes", but the PR says in its first paragraph that it is not about text scaling. .content has min-height: auto inside overflow: hidden, so any window shorter than its content clips the button with nothing to scroll it back — large text is one way to get there, a short window is another. Suggested: "The installer's content pane scrolls, so the Install button stays reachable when the window is shorter than its content."
  • A PDF "before" cannot exist — macOS PDF export did not work at all until #287, so there is no earlier build to compare against. pdf-diagrams.png stands alone as "this is what it looks like now".
  • #423 as a DevTools panel. lib.rs registers tauri_plugin_prevent_default::init() unconditionally, which blocks devtools in debug builds too, so a Network-panel shot would mean patching the app purely to photograph it. startup-js.png gives the numbers instead:
                 requests   KB decoded   largest chunk
before  first paint    14         4770        4410 KB  (Monaco + app in one chunk)
after   first paint    14          904         686 KB  (app only)
                                 −3866 KB  (−81 %)
after   entering edit mode:  +4 requests / +3868 KB / 327 ms

Since my last comment — nine merged

Things that were silently wrong. Every Mermaid diagram whose labels live in a foreignObject rendered as empty shapes — 11 of the 28 diagram types, in the preview and the exported HTML alike. ADD_TAGS: ['foreignObject'] admits the element; DOMPurify deletes HTML children of an SVG parent that isn't an integration point, which foreignobject is not, so no allowlist entry could have saved them. Not a regression from this cycle — it has been broken since the line was added in February (#455). Undo deleted the image it had just inserted, sometimes one another tab was still displaying, always as an unlink rather than a move to Trash; you picked A, so it now deletes nothing (#458). And hooks.nsi had never executed once: it defines NSIS_HOOK_POST_INSTALL, the bundler checks NSIS_HOOK_POSTINSTALL, and !ifmacrodef fails silently — which also means a5fda8e's open-with fix has never reached a user (#460).

Things people can see. Settings had two rows labelled Font and two labelled Font Size with nothing to tell them apart, and a control's left edge was wherever its own label happened to stop (#456). Marking a numbered item as a bullet left the number behind — #451, plus four unreported siblings in the same family (#457). Window tags now show what they cover with a line under the tab strip, refuse a name another window is holding, and their editor can be dismissed without committing (#459).

Tests. The tab-transfer regression you fixed in #452 was mine, and my tests didn't see it because one asserted the guard existed in the source and the other asserted the guard behaved as written — both true, while the guard was self-consistently wrong; #453 runs a transfer end to end instead. #454 stops the CRLF patches from being yours to make: one normalizing read, every test through it, and a guard so the class cannot return.

Still only you can do this

#209. The macOS build is ad-hoc signed and not notarized, so a downloaded .dmg is quarantined and TCC will not persist the file-access grant — macOS users get re-prompted on every save into Desktop/Documents/Downloads, and Full Disk Access doesn't help. It needs a Developer ID and two repo secrets. If that isn't happening this release, one line in the notes with the right-click → Open workaround would save people the "damaged and can't be opened" dead end.

Known and not fixed

Switching the app theme doesn't recolour diagrams already on screen; they keep the old theme until the file is reopened. Two independent causes, one of them in MarkdownViewer.svelte. Its own PR, after the release — it is cosmetic and I'd rather not add to this pile.

Nothing else outstanding from me. #390–#395 are answered or corrected, #368 is done, and I'm not starting anything new until the release is out.

PathGao avatar Aug 05 '26 02:08 PathGao

@PathGao perfect! 2.7.0 is now out. I'll look into the macOS developer program to address that issue as I imagine its a frustrating quirk.

thanks for all your contributions! you've helped squash a lot of bugs and add much needed features.

alecdotdev avatar Aug 05 '26 04:08 alecdotdev