From bf716a0c3940ef9a77a4a5d38581e83c0ad44411 Mon Sep 17 00:00:00 2001 From: Nolin McFarland Date: Mon, 18 May 2026 10:12:26 -0400 Subject: [PATCH] feat: add extension to normalize OSPasteboard string interface --- macos/Ghostty.xcodeproj/project.pbxproj | 1 + .../Ghostty/Surface View/OSSurfaceView.swift | 7 ++--- .../Extensions/OSPasteboard+Extension.swift | 28 +++++++++++++++++++ .../SurfaceView+SearchStateTests.swift | 4 +-- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 macos/Sources/Helpers/Extensions/OSPasteboard+Extension.swift diff --git a/macos/Ghostty.xcodeproj/project.pbxproj b/macos/Ghostty.xcodeproj/project.pbxproj index fb24d0813..6d883ded8 100644 --- a/macos/Ghostty.xcodeproj/project.pbxproj +++ b/macos/Ghostty.xcodeproj/project.pbxproj @@ -109,6 +109,7 @@ Helpers/CrossKit.swift, "Helpers/Extensions/NSImage+Extension.swift", "Helpers/Extensions/OSColor+Extension.swift", + "Helpers/Extensions/OSPasteboard+Extension.swift", ); target = 8193244C2F24E6C000A9ED8F /* DockTilePlugin */; }; diff --git a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift index d9c01b089..2bf9e4cf3 100644 --- a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift @@ -131,7 +131,7 @@ extension Ghostty.OSSurfaceView { init( from startSearch: Ghostty.Action.StartSearch, - pasteboard: OSPasteboard = OSPasteboard(name: .find) + pasteboard: OSPasteboard = OSPasteboard.find ) { self.pasteboard = pasteboard if let needle = startSearch.needle, !needle.isEmpty { @@ -143,7 +143,7 @@ extension Ghostty.OSSurfaceView { } func readPasteboardNeedle() { - let pasteboardNeedle = pasteboard.string(forType: .string) + let pasteboardNeedle = pasteboard.string if let pasteboardNeedle, pasteboardNeedle != needle { needle = pasteboardNeedle needleSelection = needle.startIndex..