Repository navigation
mac: File ▸ Print… (⌘P) prints the compiled PDF, Print Source… prints the buffer - #425
Merged
Merged
Conversation
…ations Add PrintController.swift so File > Print can reuse PDFExport.render (the Export PDF path) and File > Print Source can print a copy of the editor buffer with line numbers. Tests build NSPrintOperation without running it and check page count, paper size, job title, disabled/no-PDF state, stale compile matching Export PDF, and source text equalling the buffer. Ran: cd apps/mac && swift test --filter PrintControllerTests Result: Executed 6 tests, with 0 failures (0 unexpected) in 0.066 (0.067) seconds Next: File menu (replacing .printItem, ⌘P), palette, AccessibilityCommand, README rows, then merge origin/main. Implementation-Agent: cursor-agent cursor-grok-4.6 Commit-Executor: cursor-agent Lane-Owner: daniel-parent (mac-m5pro-dq222) Co-authored-by: Cursor <[email protected]>
Wire File > Print… (⌘P; was unbound — palette is ⌘⇧P, pin is ⌘⌥P) and File > Print Source… through PrintController. Replacing .printItem lives in a second .commands block so SwiftUI's 10-child CommandsBuilder still compiles. AccessibilityCommand, palette, README shortcuts, and the command-table parser follow. Ran: cd apps/mac && swift test --filter 'PrintControllerTests|CommandTableTests|WorkspaceShellTests' Result: Executed 24 tests, with 0 failures (0 unexpected) in 0.219 (0.221) seconds CommandTableTests: Executed 8 tests, with 0 failures PrintControllerTests: Executed 6 tests, with 0 failures WorkspaceShellTests: Executed 10 tests, with 0 failures Next: git fetch origin main && git merge origin/main (no rebase), then full swift test in apps/mac. Implementation-Agent: cursor-agent cursor-grok-4.6 Commit-Executor: cursor-agent Lane-Owner: daniel-parent (mac-m5pro-dq222) Co-authored-by: Cursor <[email protected]>
…Source with no document Print… was enabled for any non-nil result, so a .failed compile with no pages went through PDFExport.render as a blank one-page PDF. File > Print now calls PrintController.documentEnabled (change-only mirrors: toolbarHasResult, resultStatus, toolbarPageCount) and printableResult refuses the same cases with "Compile failed — nothing to print". Print Source uses toolbarHasDocument instead of a hard-coded hasDocument: true. Export PDF… and Print share ShellModel.exportPDFRefusal; retainedMarks stays diagnostics-only because Export does not fall back to it. Ran: cd apps/mac && swift test --filter 'PrintControllerTests|CommandTableTests' Result: Executed 17 tests, with 0 failures (0 unexpected) in 0.260 (0.262) seconds CommandTableTests: Executed 8 tests, with 0 failures PrintControllerTests: Executed 9 tests, with 0 failures Next: git fetch origin main && git merge origin/main (no rebase), then full swift test in apps/mac. Implementation-Agent: cursor-agent cursor-grok-4.6 Commit-Executor: cursor-agent Lane-Owner: daniel-parent (mac-m5pro-dq222) Co-authored-by: Cursor <[email protected]>
This was referenced Sep 14, 2026
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.
daniel-parent (Cursor Grok lane
preview-print, reviewed by daniel-parent plus an independent read-only Codex review). The Mac app couldn't print; ⌘P was unbound.What changes
PDFExport.render(result, dark: false), the same render path as Export PDF, so no second PDF implementation. A stale compile prints the stored result, as Export does.NSTextStorage,NSLayoutManagerandNSTextView, so the live editor view is never touched.toolbarPageCountandtoolbarHasDocument, so the App scene doesn't re-readresult/documentson every keystroke.PrintControllerrepeats the same checks, so a palette or accessibility invocation can't bypass them.PDFExport.exportPDFRefusal(), shared with Print instead of copied.AccessibilityCommandsand the README shortcut table all list both commands.Review round
The independent review found three problems, all fixed at
be8431d1:PDFExport.renderemits a blank letter page forpages: [].hasDocument: truehard-coded in its help.PrintControllerdidn't check that a document exists.Tests
PrintControllerTests(9) cover:NSPrintOperation, built without running it;swift test(apps/mac) atbe8431d1:Executed 1145 tests, with 135 tests skipped and 0 failures.Overlap check
a63537ff.README.md,AccessibilityCommands.swiftandFlashTeXMacApp.swifthook points. The conflicts are additive, and I'll resolve them on whichever lands second.Not done
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz