Skip to content

macOS: read string contents per pasteboard item#13170

Merged
mitchellh merged 2 commits into
ghostty-org:mainfrom
bo2themax:push-1da9cc0d
Jul 5, 2026
Merged

macOS: read string contents per pasteboard item#13170
mitchellh merged 2 commits into
ghostty-org:mainfrom
bo2themax:push-1da9cc0d

Conversation

@bo2themax

@bo2themax bo2themax commented Jul 3, 2026

Copy link
Copy Markdown
Member

Fixes: #13152, regression from: #4956

AI Disclosure

Claude wrote the tests before I changed getOpinionatedStringContents

claude and others added 2 commits July 3, 2026 12:53
@bo2themax bo2themax requested a review from a team as a code owner July 3, 2026 11:31
@ghostty-bot ghostty-bot Bot added the os/macos label Jul 3, 2026
.joined(separator: " ")
let strings = (pasteboardItems ?? []).compactMap { item in
if let plist = item.propertyList(forType: .fileURL),
let fileURL = NSURL(pasteboardPropertyList: plist, ofType: .fileURL) as URL?,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We can theoretically read string(forType: .fileURL) then URL.init(string:), but I want to keep the behavior as close to previous version as much possible. I assume readObjects(forClasses: [NSURL.self]) is using NSPasteboardReading internally as well based on the doc.

@mitchellh mitchellh merged commit 8d83849 into ghostty-org:main Jul 5, 2026
94 checks passed
@mitchellh mitchellh added this to the 1.4.0 milestone Jul 5, 2026
@bo2themax bo2themax deleted the push-1da9cc0d branch July 6, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS paste prefers NSURL over plain text, causing Transmit SFTP paths to paste as sftp:// URLs

3 participants