Add full clip context menu actions - #42
Conversation
|
A lot of good work here, and two blockers. The edit path can make CloudKit delete the clip you just edited. The editor has no working Cmd-C / Cmd-V / Cmd-Z / Cmd-A / Cmd-F. Pesty never installs a main menu - Smaller ones:
My real ask: split this. Six commits and ~921 lines bundle five independent features plus two infrastructure fixes. The two infrastructure fixes are the strongest part and could land today on their own - the key-monitor scoping ( |
…et robustly (#66) Two infrastructure fixes extracted from #42: - The local key monitor now ignores events destined for any window other than the bar panel, so typing into the Rename / Create Pinboard alerts (and any future editor or Settings surface shown while the bar is up) reaches that window instead of being swallowed into search. - Pasting resolves its target through lastActiveApp -> previousApp -> frontmost, skipping Pesty itself and terminated apps. previousApp is only captured inside showBar(), so the menu-bar and reopen paths used to paste into a stale target. showBar() also keeps lastActiveApp in sync when it captures the frontmost app. Co-authored-by: momenbasel <momenbasel@users.noreply.github.com> Co-authored-by: Alvie Stoddard <alviestoddard@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
momenbasel
left a comment
There was a problem hiding this comment.
Maintainer pass — infrastructure extracted and merged; requesting changes on the remainder.
Action taken: per the Aug 11 review's split request, the two infrastructure fixes landed on main today via #66 with Co-authored-by credit — the event.window === barController?.window key-monitor scoping (which fixes typing into the Rename / Create Pinboard alerts) and the pasteTarget chain (lastActiveApp → previousApp → frontmost, skipping Pesty/terminated apps) with showBar() keeping lastActiveApp in sync. Please rebase; those hunks will drop out.
What still blocks the rest (unchanged since the review — last commit here predates it):
- Edit-path CloudKit data loss:
updateTextContent/updateColorContentskip thesameContentdedupe, so an edit that collides with an existing clip creates two records with one content key, and the sync reconciliation deletes the edited record from the very device that edited it. Route edits through the dedupe and pick the tie-break deliberately. - The editor is dead without a main menu:
NSApp.mainMenuis nil, so ⌘C/⌘V/⌘Z/⌘A/⌘F never reach the NSTextView andallowsUndo/usesFindBarare inert. A minimal main menu is the real fix (and also fixes ⌘Q / ⌘W app-wide). - Smaller, all still open: Save bound to Return conflicts with typing newlines (bind ⌘↩);
previewedItemIDnever cleared and no preview-window delegate;updateContentassumes pinboard copies share the history UUID (false since 1.2.0 minted per-container UUIDs);renameItempre-fillsdisplayTitleinstead ofcustomTitle ?? "", baking auto-titles in; editing silently overwrites the live clipboard with no UI hint.
The Preview/Share/Edit/menu work itself is genuinely good — split it into reviewable pieces on top of current main and each one can land quickly.
— automated maintainer pass on behalf of @momenbasel
|
Superseded by #78, which reimplements this on current |
The context menu now offers Paste to <target app>, Paste as Plain Text, Copy, Edit, Writing Tools, Rename, a Pin submenu with colored pinboard dots, Preview, Share, and Delete. Editing opens a native rich-text editor panel with formatting controls, live stats, undo, find, and Writing Tools; colors get a color-well editor. Edits can no longer make CloudKit delete the clip that was just edited: updateContent bumps createdAt and removes same-content duplicates in the same container as an explicit, deliberate delete, so the edited record is always the newest copy of its content key and remote dedupe can never drop it into a reconciliation delete. Edits update the existing record in place - no delete and recreate, no dropped fields - and pinboard copies with their own UUIDs are left untouched while legacy shared-id copies stay consistent. A minimal main menu is installed at launch so the editor's Cmd-Z/X/C/ V/A/F shortcuts, Cmd-Q, and Cmd-W actually work; the app stays an accessory so no menu bar appears. Save in the editor is bound to Cmd-Return since Return types a newline, Rename pre-fills the custom title rather than baking in the auto-generated one, the preview window clears its tracked item via a window delegate when closed, and editing no longer silently overwrites the live system clipboard. Supersedes #42. Builds on the key-monitor scoping and pasteTarget infrastructure from #66. Co-authored-by: momenbasel <momenbasel@users.noreply.github.com> Co-authored-by: Alvie Stoddard <alviestoddard@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
What changed
Why
This implements the complete contextual workflow requested for a clip, including the system-provided Writing Tools path rather than an imitation.
Validation
swift buildVERSION=1.0.0 BUILD=1 ./scripts/build_app.shgit diff --checkScreenshots
Demo mode — Pesty window only.
Follow-up: editor polish
Validation:
swift build,git diff --check.