Repository navigation
Mark Blurt's clipboard writes so history apps skip them - #313
Open
theluckystrike wants to merge 1 commit into
Open
theluckystrike wants to merge 1 commit into
theluckystrike wants to merge 1 commit into
Conversation
The paste path writes the transcript to the clipboard and restores the old contents afterwards. Neither write was marked, so clipboard history apps recorded every dictation and then added the old clipboard again as a new entry. The transcript written for a paste now carries the nspasteboard.org TransientType and AutoGeneratedType markers, the restore carries TransientType, and every write sets org.nspasteboard.source to the app's bundle identifier. The manual paste fallback is left unmarked. SystemClipboard takes an optional pasteboard name (default .general) so the new tests run on a private pasteboard. Fixes AssemblyAI#310
This branch has not been deployed
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.
Fixes #310.
Blurt pastes by putting the transcript on the clipboard, pressing Cmd-V and restoring the old contents 400 ms later. Neither write was marked, so clipboard history apps such as Raycast saved every dictation (also text dictated into a password field), credited it to the app in front, and then added the old clipboard again as a new entry.
SystemClipboard now follows the nspasteboard.org markers that these apps read.
SystemClipboard takes an optional pasteboard name (default .general), so the new tests in SystemClipboardMarkerTests run on a private, uniquely named pasteboard and never touch the clipboard of the person running them. The existing SystemClipboardTests still use the general pasteboard as before.
How I checked it. swift build passes and swift format lint is clean. The machine I used has the Command Line Tools only, without the Testing module, so I could not run swift test. I compiled SystemClipboard.swift on its own into a small test program that runs the same 4 cases on a private pasteboard, and all pass with the general pasteboard left untouched. Please run the suite in CI or Xcode.