Skip to content

Files: opening or saving a presentation joins the macOS recent-documents list - #680

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/dock-recent-docs-7e0f
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/dock-recent-docs-7e0f

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • Opening or saving a presentation (.deckcraft, .slidecraft, .pptx, .potx, .ppsx) records it via NSDocumentController.noteNewRecentDocumentURL, the list the Dock and Apple menu read.
  • Pictures, PDFs, outlines and other exports are not recorded.
  • The Dock menu of a packaged app shows these once the bundle declares its document types (in the open Finder/Dock-open PRs; not added here).

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace (except 3 known macOS env font/IME failures)
  • cargo xtask assets, layers, wasm
  • Extension filter unit test
  • macOS: a .deckcraft path appears in recentDocumentURLs, a .png does not
  • Dock right-click menu on a packaged app (needs the document-type declaration from the open Finder PRs)

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…#4744) (storytold#680)

* macOS: IME text committed after the marked text is cleared isn't lost (winit#4650)

winit 0.30.13 reports insertText as Ime::Commit only while marked text is
left, and after any commit it swallows the next key. Real paths where that
loses text:

- input methods that end a composition with unmarkText, then insertText
  (rust-windowing/winit#3925): the committed text was dropped;
- Apple Korean 2-Set, for the key typed after a syllable: on 한 then 5 it
  calls setMarkedText("한"), insertText("한"), setMarkedText(""),
  insertText("5"), so the 5 (or ;, or any key that ends the syllable) was
  dropped;
- a commit made outside a key press (a candidate clicked with the mouse,
  dictation): no key follows to reset the state, so the next key (for
  example Backspace) was swallowed.

vendor/winit now commits when a composition was started (pending_commit,
set in setMarkedText, cleared by the commit and when IME is disallowed);
other insertText calls still reach the app as KeyboardInput. A commit
outside keyDown clears the marked text and returns to the ground state.
validAttributesForMarkedText lists the underline and marked-clause
attributes, which some input methods need before they compose.

This is rust-windowing/winit#4650, the 0.30 backport of #4651 (merged on
winit master), plus the part of #4748 that fixes #4651's out-of-key-press
case (#4748's other parts are not included). One correction: upstream
spells the underline attribute "NSUnderlineStyle", but AppKit's
NSUnderlineStyleAttributeName is "NSUnderline" (printed on macOS 14), so
the AppKit value is used.

Checked with the real input methods on macOS 14.7.1 (a scratch winit app fed
key events through AppKit): with the patch 한+5 and 한+; commit the 5 and ;,
unmarkText-then-insertText commits, and Backspace after a commit outside a
key press is delivered; ABC typing, held keys, Japanese (日本, あ), Cangjie
(日) and Korean composition give the same events as before. A test fails if
a re-vendored winit loses the patch.

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

* macOS: the first Apple Korean key in a fresh PdfCraft composes (winit#4744)

On the first key after PdfCraft starts, Apple Korean 2-Set can answer
interpretKeyEvents with insertText and the raw compatibility jamo instead of
setMarkedText. winit sends that key to the app as an ordinary key, and the
next keys compose without it: g k s Space typed ㅎㅏㄴ instead of 한 (Search,
form fields, comments; rust-windowing/winit#3095).

vendor/winit now ports rust-windowing/winit#4744: keyDown interprets that
one key a second time, synchronously, before any KeyboardInput is sent, and
only when every condition holds: Apple Korean, IME allowed and not yet
composing, no pending commit or marked text, no Command/Control/Option, not
a repeat, the key window's first responder, the only callback is one
insertText of that same single jamo, and focus and input source unchanged
afterwards. The decision is ImeStartup (ime_startup.rs, copied with its
seven tests); no timer, no key queue, no text rewriting. It sits on top of
the previous macOS IME change (pending_commit, in_key_down); the retry runs
inside in_key_down. Command maps to ModifiersState::SUPER in winit 0.30
(META on winit master).

Checked with the real input method on macOS 14.7.1 (scratch winit app, fresh
process each time): without the patch g k s Space gave ㅎ as a key, then
ㅏ and ㄴ committed separately, 3 runs out of 3; with it, ㅎ → 하 → 한 → 한
committed, 3 out of 3. All other traces (Japanese, Cangjie, ABC, held
keys, later Korean keys) are unchanged. ImeStartup's tests pass with
rustc --test. A test fails if a re-vendored winit loses the patch.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Opening or saving a presentation tells NSDocumentController, which is the
list the Dock and the Apple menu read. Pictures, PDFs and outlines are
copies, so they stay off that list. The Dock menu shows the entries once
the app bundle declares its document types.

Co-authored-by: Cursor <cursoragent@cursor.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: opening or saving a presentation joins the macOS recent-documents list (the Dock and Apple menu), and exports do not. The UI crate gains macOS-only dependencies objc2 0.6, objc2-app-kit 0.3.2 and objc2-foundation 0.3.2 for calling NSDocumentController. The objc2 family is widely used and maintained, but calling AppKit from Rust needs unsafe for the FFI unless the crates' safe wrappers cover it, and the organisation forbids unsafe outside two crates; the code must either use the safe API or live in an allowed crate. The same dependencies are in other macOS PRs. A recent-documents entry holds a path, which is user data that the user can clear from the Apple menu. I have not run it (macOS), and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026
@aiongg aiongg self-assigned this Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

No blocking problems found (not certain).

Opening or saving a presentation now records it in the macOS recent-documents list. Exports are filtered out by extension, and other platforms do nothing.

  • crates/ui-egui/src/lib.rs:1195 records from note_recent. That one place covers the synchronous open, the background open (crates/ui-egui/src/opening.rs:78), the command-line open (apps/deckcraft/src/main.rs:258) and the control channel's open.
  • Save (crates/ui-egui/src/lib.rs:1304) and Save As (crates/ui-egui/src/lib.rs:1270) record the path only on success. The menu, toolbar, Backstage and close-prompt Save all go through these two functions.
  • crates/ui-egui/src/recent_docs.rs:8 matches the extension case-insensitively and leaves out pictures, PDFs and outlines. Backstage saves to .potx/.ppsx go through export_as, so they are not recorded either.
  • The control channel's app.save (crates/ui-egui/src/control.rs:362) runs file.save directly and does not record the file. The app's own Recent list has the same gap.
  • crates/ui-egui/src/recent_docs.rs:17 canonicalizes the path on every platform, though only macOS uses the result. Moving the call inside the macOS branch would save a filesystem call per save elsewhere.
  • The new progress-log rows in ROADMAP.md and docs/ui-parity.md are dated 2026-10-14 but sit among 2026-10-13 rows.

Claims checked:

  • verified: Opening a presentation records it in the macOS recent-documents list (crates/ui-egui/src/lib.rs:1195 calls recent_docs::note_system_recent in note_recent. That function is reached from open_path (crates/ui-egui/src/lib.rs:1184) and the background open (crates/ui-egui/src/opening.rs:78). crates/ui-e…
  • verified: Saving a presentation records it in the macOS recent-documents list (crates/ui-egui/src/lib.rs:1270 (Save As, on success) and crates/ui-egui/src/lib.rs:1304 (Save, on success). Menus, the toolbar, Backstage and dialogs call app.save (crates/ui-egui/src/menus.rs:33, crates/ui-egui/src/qat.rs:94, cra…
  • verified: Only .deckcraft, .slidecraft, .pptx, .potx and .ppsx are recorded; pictures, PDFs, outlines and other exports are not (crates/ui-egui/src/recent_docs.rs:8-13 matches the lowercased extension against those five. crates/ui-egui/src/recent_docs.rs:42-44 returns None for anything else. Backstage export…
  • verified: Other platforms keep only the app's own recent list (crates/ui-egui/src/recent_docs.rs:18-21 calls macos::note only under cfg(target_os = "macos"). The objc2 dependencies are target-gated in crates/ui-egui/Cargo.toml.)

Recommendation: merge, after a maintainer's decision.

Reviewed at 6ee24f8.

@aiongg aiongg removed their assignment Nov 5, 2026
@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Automated message. Not a maintainer decision.

This branch conflicts with main. Could you merge or rebase main into it? The conflict needs a person to resolve.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants